Home Documentation How to How to use different templates?
How to use different templates? PDF Print E-mail
Written by Ivo Apostolov   
Wednesday, 25 April 2007 23:01

See JOOMFISH 1.7 Tips & tricks in the Joomla! Forums.

Taken from that post:

TIP 1 - HOW TO LOAD A CSS DEPENDING OF THE LANGUAGE FRONT-END SWITCH ?

1. Add the following tag in your template index.php file:

<link href="<?php echo $mosConfig_live_site;?>/templates/
YOUR TEMPLATE NAME/css/<?php echo $mosConfig_lang;?>.css" rel="stylesheet" type="text/css"/>

This will write CSS files, depending of the selected language: english.css, spanish.css, german.css, italian.css, portuguese.css, etc...

2. If your defaut joomla language is set to english, then leave english.css empty & place it in the /templates/YOUR TEMPLATE NAME/css/ directory. Customize the other css files according to your needs. The most natural use is to change the path to an image file:

#whatever { 
background-image: url("../images/header_german.gif");
for the german.css file
}
#whatever {
background-image: url("../images/header_spanish.gif");
for the spanish.css file
}

Place the produced CSS files into the /templates/YOUR TEMPLATE NAME/css/ directory

How to select a template based on the language front-end switch?

The most easy solution is to add the following lines in your index.php

  // gets template for page 
$cur_template = $mainframe->getTemplate();
// add this
if( $mosConfig_multilingual_support ) {
$cur_template .= "-". $iso_client_lang;
}
else {
$cur_template .= "-en";
}

Now every template would be named with his standard name plus a "-en" or "-de" or anything else.

 

0 Comments

Add Comment


    Selected Contributors

    From the Joom!Fish Core team (Alex, Geraint, Ivo & Robin) a big thank you to all the people of the JoomFish community!
    Special thank's for testing, good suggestions, translations and forum moderation to:

    • Tommy White for the cute logo design
    • Bernhard, Michael, Luc, Olivier, Robin, Rune, Akarawuth
    • Harri <aka tassu> for moderation

    Ads by Google