homepage Welcome to WebmasterWorld Guest from 54.227.34.0
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
language sorting in php vs.SE spiders
vanekpavel

10+ Year Member



 
Msg#: 513 posted 11:40 am on Jul 14, 2002 (gmt 0)

Hi
if i want to put in my page some language sorting to sent folks to the their native language versions of my www pages i can do it following way:

<?
switch($HTTP_ACCEPT_LANGUAGE):

case "hr":
include ("indexav.html");
case "bg";
include ("indexae.html");
case "en-au":
include ("indexas.html");
break;
default:
include("indexa.html");
break;
endswitch;
?>

But what about the Search engine spider will they be able to pass the index.php file?

 

Brett_Tabke

WebmasterWorld Administrator brett_tabke us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 513 posted 2:46 am on Aug 13, 2002 (gmt 0)

*bump* (was posted in the wrong forum).

toadhall

10+ Year Member



 
Msg#: 513 posted 5:22 am on Aug 13, 2002 (gmt 0)

Hi vanekpavel,

The answer is in the switch statement.

If the agent (browser or SE bot) doesn't request any of the specified languages then it will default to indexa.html.

As it stands if the browser requests Bulgarian, Croatian, and Australian English the script will try to include indexav.html, indexae.html, and indexas.html. If this isn't what you want insert break; after each of the top two includes. Then the script will serve the index file related to the first request sent, and only that one, or default to indexa.html.

BTW, the last break; (after include("indexa.html");) isn't necessary.

Cheers.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved