PDA

View Full Version : A question how to do


KFredje
09-26-2009, 12:09 PM
Hi

I'm not sure but I guess this is the right section.

I got a site, in 3 languages. Each language is located in a subfolder with the 2 characters of that country (like for Dutch it's in a folder BE). Now my site counts 3 languages and if I update something on 1 page I have to do it on the others as well. I was wondering if there is something so I can easily type something in 3 boxes in 3 different languages and that it's automatically updated on the right places on my site.

I really hope some1 can help me out with this.

Tnx

misheck
10-03-2009, 12:40 AM
Hi I will try my best to help but I am newbie.

I have a few more questions to ask before I can suggest a solution. So do you want 3 input boxes on 1 page to enter the data to all folders? How are the three languages retrieving their data? Are you using a database?

Coyote6
10-03-2009, 01:11 AM
Well in a very simplistic way you could have a database table that has a site id reference and page id reference and then have your database call from the correct text.


Sites
id | url
1 | english.site.com
2 | dutch.site.com
3 | french.site.com

Pages
id | url
1 | index.php
2 | contact_us.php

Content
id | site_id | page_id | text
1 | 1 | 1 | Text in English
2 | 2 | 1 | Text in Dutch
3 | 3 | 1 | Text in French
1 | 1 | 2 | Text in English
2 | 2 | 2 | Text in Dutch
3 | 3 | 2 | Text in French




// Get the requested uri and server host to retrieve the data.
$site_url = $_SERVER['HTTP_HOST'];
$page_url = $_SERVER['REQUEST_URL'];

// Check & Escape your data here.
#### MORE CODE ####

// Query the database to get that page's content.
$q = "SELECT text FROM Content as c, Sites as s, Pages as p WHERE c.site_id=s.site_id && c.page_id=p.page_id && page_url='$page_url' && site_url='$site_url'";


Then create a just create a form to insert into the content table for each page. Again this is a really simplified explanation and should get a lot more thought put into it.

Coyote6
10-03-2009, 01:12 AM
If you point all sub-domains to the same file that would also allow you to only have to upkeep one set of code.