Forum Moderators: coopster

Message Too Old, No Replies

Multilingual website - dynamic path problems!

         

bernk

12:03 pm on Dec 4, 2007 (gmt 0)

10+ Year Member



Hello.
I'm developing my first multilingual website. I'm a little stuck in the dark so I'm hoping someone can shed some light for me.

This is the hierarchy I have:

/index.php - checks which language the user has set as first choice

/en/ - if it's English the user is directed to the English site

or

/es/ - if it's Spanish the user is directed to the Spanish site

In each of these directories I have a completely separate copy of the site, sharing no common assets, styles, or pages.

A section page looks something like this:


<?php $pageTitle = "About Us"; require($_SERVER["DOCUMENT_ROOT"]."/ssi/header.php");?>
<h1>Section Title</h1>
<div id="content">Blah blah blah</div>
<?php require($_SERVER["DOCUMENT_ROOT"]."/ssi/footer.php");?>

The trouble with this is that it doesn't work...
I developed the site as a simple, flat, non-dynamic template. I was then asked to fully develop it into the bilingual site.

The site structure is something like this:

/About/Index.php +subsections
/People/Index.php +subsections
/Facilities/Index.php +subsections
/css/screen.css +others
/js/somescript.js
/ssi/header.php
/ssi/footer.php

And of course each of these paths is preceded by either "en" or "es" depending which site the user is using.

Any ideas, or resources I should look at? I've searched a bit and couldn't find a good explanation of how to set this up.

Sagaris

12:55 pm on Dec 4, 2007 (gmt 0)

10+ Year Member



As you have a seperate set of assets for each directory you need to append the base directory that you can access through $_SERVER['DOCUMENT_ROOT'].

To do this I would do the following

$path = $_SERVER['DOCUMENT_ROOT']."/en";

This will allow you to include require files like this

require($path."/ssi/footer.php");

Hope this helps