Jump to content

murat@pw

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by murat@pw

  1. @Wanze, thanks for the answer, worked like a charm. Now I've another question. Here is my languages setup: default ---> Turkish (Türkçe) / name ---> tr ------------------------------------------------------------------- other ---> English (İngilizce) / name ---> en ------------------------------------------------------------------- flags ---> tr.png / tr_off.png / en.png / en_off.png ------------------------------------------------------------------- In my working code I setup the language names as two letter codes (tr and en), and this is not good for the content editor. However, if I setup the language names as normal (Türkçe and İngilizce, for Turkish and English, respectively) I cannot get the two letter code for images. My question is how can I get two letter codes to put as flag image's sources when the language names are set as Turkish and English? Thanks.
  2. @Wanze the src of flag images was <img width='32px' src='site/assets/images/".$language->title.".png' />"; and when I used absolute path as <img width='32px' src='http://xxx.yyy.edu.tr/site/assets/images/".$language->title.".png' />"; the error of flag images disappearing in second language pages gone The whole code for language switcher in main.php file is as follows (I updated the flags with two states, i.e. active flag is in color, the other flag is in grey). <ul class='languages'> <?php $currentLanguage = $user->language; // remember language $flag = ''; foreach($languages as $language) { if(!$page->viewable($language)) continue; // is page viewable in this language? $user->language = $language; if($language->id == $currentLanguage->id) { //echo "<li class='current'>"; $flag = "<img width='32px' src='http://fbe.ogu.edu.tr/site/assets/images/".$language->title.".png' />"; } else { //echo "<li>"; $flag = "<img width='32px' src='http://fbe.ogu.edu.tr/site/assets/images/".$language->title."_off.png' />"; } //echo "<a href='$page->url'>$language->title</a></li>"; echo "<a href='$page->url'>$flag</a>"; } $user->language = $currentLanguage; // restore language ?> </ul> And here are screenshots of final look
  3. @Wanze, Thanks for the quick reply. Actually I managed to get the flags by editing the main.php file as you recommended. Then, I got another problem which was when I click the second language's flag (English in my site) the page opens in that language but the flag images on top disappears as there is no img at http://localhost/fbe_pw/en/site/assets/images/tr.png. I was trying to solve this problem that is why I did not update my original question. In fact, I came across this problem and a solution for it somewhere when I was reading about PW, but now I cannot find it EDIT: I've solved the problem of flag images disappearing by defining them in main.php as absolute URLs . Probably this is not an optimal solution, but it works (until I will find the other solution somewhere again).
  4. Hello, I'm new to this great system (PW), not a coder, and trying to make a multilingual website (Turkish and English, Turkish being the default) for The Graduate School where I've worked for 12 years. I've installed the default multilingual site profile, changed the default language to Turkish, and now what I'm trying to do is to use country flags as language switcher instead of the default text links on the upper right corner of the page. Thanks in advance.
×
×
  • Create New...