Forum Moderators: coopster

Message Too Old, No Replies

Automatically link pages to equivalent language

How to automatically link pages to their equivalent foreign langauge page.

         

Aries1385

8:13 am on May 31, 2008 (gmt 0)

10+ Year Member



Hi,

We have this website which is translated to different langauges, right now when there are new translation pages we have to manually create a language link e.g. german english french and then link each one to the equivalent language which sometimes causes error because of mis-linking. what we want is a way for us to enter just one code and then when online the language links will automatically be linked to the equivalent page on the other languages.

I suspect we need a database for this and our database will have these fields.

german url
english url
french url

We also need a way for us to enter the records online.

Please help. I am a newbie in PHP.

Thanks,
Aries

henry0

11:20 am on May 31, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Aries 1385 Welcome to WebmasterWorld!
if each page is hard coded in PHP
you could have a database withe one col per language (country_id), page_name, page_url etc....
plus in case you need it an autoincremented page_id

Then write on each page top:
country_id="fr"; etc...

Your navigation could be switch based [us2.php.net] to define each country case.

If the pages are created/copied from a template system you could use fopen [us2.php.net] to open the page
and write to the page using fseek [us2.php.net] to a pre defined spot that country_id
using fwrite [us2.php.net]

hope I am on the right track :)

cameraman

4:12 pm on May 31, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, Aries1385!

Have you looked into content negotiation [httpd.apache.org]? It's not an easy read but its purpose is exactly what you're describing.

henry0

9:36 pm on May 31, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cameraman,
we had maybe two or three months ago quite an interesting thread about content negotiation, I used to be very much in favor of content negotiation, but it seems that it is not really that much of a fool proof system.

if a mod or a member remember where that thread is, please post a link.

phranque

8:42 am on Jun 1, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



perhaps this is that content negotiation thread:
[webmasterworld.com...]

henry0

12:33 pm on Jun 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Indeed, thanks!

Aries1385

4:00 am on Jun 2, 2008 (gmt 0)

10+ Year Member



Hi,

I am really a PHP newbie so I am still finding my way in PHP. Can anyone tell me how to do this or give me a sample code where I can paste in the page.

Thanks alot.

Aries