Jump to content

redmike

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

redmike's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I tried this one and yes its working only in "zh-hant" and zh-hans". But the default displays nothing. That is why I think parsing the url works well. I dont know how to make the default works. Is it maybe because Im using includes instead of echo to display everything? I understand yes, curPageURL() function doesn't do anything here. I didnt use it anywhere too. But I find more useful that the "_GET". if(isset($_GET['lang'])) { switch($_GET['lang']) { case 'zh-hans': include (TEMPLATEPATH . '/branches-cn.php'); //branches pages contains the translated images break; case 'zh-hant': include (TEMPLATEPATH . '/branches-tcn.php'); break; default: include (TEMPLATEPATH . '/branches.php'); //This is my english page break; } } Is there something missing here? Why is the english images not displayed?
  2. so you mean this is wrong even if it works well on my part? I added this on the above script: $lang= curPageURL(); $query = parse_url($lang, PHP_URL_QUERY ); if ($query=="lang=zh-hans")
  3. Oh i see! its working now. Sorry I messed up. I use this to assign. : // To assign $query = parse_url($url, PHP_URL_QUERY ); thanks stuart!
  4. I still dont know to match the URL and characters that I get after parsing. I still get the english images only...
  5. Wow this answers my problem! Thank you so much!
  6. Hi sir! Because I have images (that has english embedded). I also have same images that has chinese/taiwanese characters embeded. I want to get the last part "?lang=zh" because i have code that if the URL has "lang-zh" it will get the chinese images. heres my sample code that i use. < ? function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } $lang= curPageURL(); if ($lang=="http://www.website.com/?lang=zh-hans") echo "<a href=\"#\" border=\"0\"><img src=\"http://www.website.com/cn/visa-2.png\" ></a>"; elseif ($lang=="http://www.website.com/?lang=zh-hant") echo "<a href=\"#\" border=\"0\"><img src=\"http://www.website.com/cnt/visa-3.png\" ></a>"; else echo "<a href=\"#\" border=\"0\"><img src=\"http://www.website.com/en/visa.png\" ></a>"; ? > This code is okay only under the index.php page. But when im under the inside pages it doesnt work anymore unless I manually add all the needed pages to be translated with images. I have lots of pages to translate. So I think It would be more easier for me if I only get the "?lang=zh-hant" for taiwan images and "?lang=zh-hans" for chinese images. Am I making it clear to you? Actually I dont know how to explain it using programmer's language but Im pretty sure Im explaining it using leighman's.
  7. Hi guys! I am learning PHP now and I am enjoying it. Im not an I.T. graduate that is why Im having very difficult time to understand codes. My problem is how to get the last character of a URL that I get using another php code. I can already post the URL on my page but it displays all the URL of the certain page that I get. Example: the URL is "http://mysite.com/page_1/pp1/?lang=zh" I only want to get the "?lang=zh". I am working under 3 languages and I want to get only that last part of the URL for me to continue my work. I dont exactly know what string or filtering I will do to get that part only. Please help me guys. I will appreciate all your comments here.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.