Main purpose is to hide strange values inside search engines like href="main.php?lingual=en" <ul> <li> <a title="en" href="">en</a></li> | <li> <a title="fr" href="">fr</a></li> | </ul>
How to improve this code or make it corrected?
whitespace
10:41 pm on Jun 12, 2015 (gmt 0)
Main purpose is to hide strange values inside search engines
I'm not really sure what you mean. The code you have seems OK. You need the language (ID) in the URL somewhere for Google to be able to index it. Whether that is as a query string parameter (like you have) or as a "pretty / user friendly" URL (eg. "example.com/en/main") - it doesn't matter as far as the search engine is concerned (Google at least).
(The only "improvement" I'd make to your language lookup is to make the language-id the index of the array and test with isset(), rather than in_array().)
toplisek
10:37 am on Jun 13, 2015 (gmt 0)
I have the following link without href: <ul> <li> <a title="en" href="href="http://www.mydomain/">English</a></li> | <li> <a title="fr"href="http://www.mydomain/">French</a></li> | </ul>
if(isset($_GET['lingual'])) { if($_GET['lingual'] == 'English') {$_SESSION['language'] = 'en';} if($_GET['lingual'] == 'French') {$_SESSION['language'] = 'fr';} } How to GET value English not from href like http://www.example.com/index.php?lingual=en
Need help.
whitespace
12:14 pm on Jun 13, 2015 (gmt 0)
You can't do what you are trying to do.
In order to get the language value server-side, you need to either use a URL parameter (GET) like you mentioned above. Or submit the data via a form (POST) (or perhaps using AJAX - GET/POST) - but this is not good for SEO, if that is a concern.
This sounds exactly the same as neophyte's recent question/thread: [webmasterworld.com...]
toplisek
12:31 pm on Jun 13, 2015 (gmt 0)
I have read. Interesting reading. If you use form and get language than search engine will miss pages for all languages beside default.
So, without using path href like http://www.example.com/index.php?lingual=en it will be SEO mistake.