Forum Moderators: phranque
My question is this. Would it be easy to have pages that call in the relevant language pages using SSI. For example I have the page and then two sections on that with the Menu and Content - both of these sections would link to external pages to bring in the relevant language content for each of those sections.
Firstly is that possible? Secondly I'm very, very new to SSI so how would I call the French content if I was in the French site and the English content if I was in the Default site?
Any help would be very, very much appreciated.
[edited by: coopster at 9:23 pm (utc) on Mar. 24, 2009]
[edit reason] no personals please TOS [webmasterworld.com] [/edit]
Make all URLs to the English version look like example.com/en/example.html and all URLs to the French version look like example.com/fr/example.html
Use mod_rewrite or equivalent to redirect the server to the file without the starting /en or /fr.
In each file, as you mentioned use <!--#if --> to figure out what language to use:
<!--#if expr="\"$DOCUMENT_URI\" != /^\/en/" -->
<!--#include french_version-->
<!--#else-->
<!--#include english_version-->
<!--#endif-->
I can't remember if you can use variables inside include statements, if you can, then you can just do this at the top of each page:
<!--#if expr="\"$DOCUMENT_URI\" != /^\/en/" -->
<!--#set var="lang" value="fr"-->
<!--#else-->
<!--#set var="lang" value="en"-->
<!--#endif-->
Then in the rest you simply do:
<!--#include virtual="/{$lang}/htmlchunk" --> Hope this helps
.htaccess ::
<!--RewriteEngine on-->
<!--RewriteRule ^.htaccess$ - [F]-->
<!--RewriteRule ^goto/$ goto/index.php-->
<!--RewriteRule ^(.*).htm$ index.php-->
<!--RewriteRule ^(.*)/$ index.php-->
index.php ::
<!--$url=$_SERVER['REQUEST_URI'];-->
<!--$url= explode("/",$url);-->
if it is necessary that splits further
<!--$url[2]= explode(".",$url[2]);-->
well and below that has described idfer
<!--if $uri=="/indexen.html"> header("Location: en/index.html");-->
<!--if $uri=="/indexfr.html"> header("Location: fr/index.html");-->
well or something in this spirit
want good luck!