2013-02-16, 20:55:08
(2013-02-16, 20:32:52)alex_d Wrote: Is there a way to call other (language specific) include template within main template when switching language?
So lets say I have ‘template.php’ for English with one include template<?php include(name-EN.inc.php'); ?>.
Now when I switch to the second language for example German, the ‘template.php’ should load only second (German specific) include template <?php include(name-DE.inc.php'); ?>
The currently displayed language can be found in the global variable $language.
So your main template file could look like this:
Code:
<?php
global $language;
include('template-'.$language.'.inc.php');
If there are just small differences between the languages, you could also just add the language as style to the body tag and do the styling with css - template.php:
Code:
...
<body class="lang-<?php global $language; echo $language; ?>">
...
Code:
...
body.lang-de p { /* special styles for paragraphes in german */ }
...