Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi Folks
I was trying custom my frontpage with i18n. (with tpl.php files) I read a lot of things in special http://drupal.org/node/134003
But unfortunately didn't work for me.
So I created this snippet to use in page.tpl.php . I am not sure will work in production site because my website isn't finished.
I will appreciate comments and know if is working well.
<?php
if (arg(0)=="admin" && i18n_get_lang() == 'en') {
include('page-default.tpl.php');
return;
}
elseif (arg(0)=="admin" && i18n_get_lang() == 'it') {
include('page-default.tpl.php');
return;
}
/* repeat to all languages */
elseif (arg(0)=="node" && arg(1)=="add" && arg(2)=="mycck" && i18n_get_lang() == 'en') {
include('page-mycck.tpl.php');
return;
}
elseif (arg(0)=="node" && arg(1)=="add" && arg(2)=="mycck" && i18n_get_lang() == 'pt') {
include('page-mycck.tpl.php');
return;
}
elseif (arg(0)=="node" && arg(1)=="add" && arg(2)=="mycck" && i18n_get_lang() == 'it') {
include('page-mycck.tpl.php');
return;
}
/* repeat to all languages, and insert all paths of drupal */
elseif (i18n_get_lang() == 'en') {include('front-en.tpl.php');return;}
elseif (i18n_get_lang() == 'it') {include('front-it.tpl.php');return;}
elseif (i18n_get_lang() == 'pt') {include('front-pt.tpl.php');return;}
elseif (i18n_get_lang() == 'fr') {include('front-fr.tpl.php');return;}
else
include 'page-default.tpl.php'; /*if none of the above applies, load the page-default.tpl.php by macm */
return;
?>
Regards
macm
Mario
Comments
try panels2
http://drupal.org/node/256558
greets,
Drupal Berlin
________________
http://www.drupalberlin.com
It's actualy far easier than this
You can include in your settings.php (sites/default)
'site_frontpage' in your $conf['i18n_variables']
then go to: /admin/settings/site-information and apply a different node per language by switching languages within this page. Works as expected, and no need for coding anything.
Greetings from Barcelona
thats a great solution!
thats a great solution! thanks!
--
keine zeit für spielkonsolen mein leben ist jump n run!
valderama.net
Custom page-front.tpl.php
In my page-front.tpl.php i'm using this:
If you are on the front page node (main frontpage declared in site-configuration), it displays the content of page.tpl.php, else you are redirected to the translated version of the that node.
this snippet is dynamic, and you simply add it to any theme and it works, you have a drupal i18n front-page
A very simple way to have multilingual front pages in Drupal
See details here: http://drupal.org/node/256558#comment-5616292