Home Документация Уроци How to use language dependent images?
How to use language dependent images? ПДФ Печат Е-мейл
Написано от Ivo Apostolov   
Сряда, 25 Април 2007 22:36
NO TRANSLATION AVAILABLE

Using language depended images referes to two different sections:

  • Images within content
  • Images or styles within the template

A related topic is the use of different styles or layouts in a template.
It is generally adviced to use different directories for the different language related images or styles.

Images within content

To change the images within the translated content you can use the additional image files. The translatable fields are not handled like in the standard content dialog, but you can easily copy the original values and change the name of the image in the text field.

Images or styles within the template

The easiest way to handle this issue is to make the template aware of the posiible languages. This can be handled by adding either a reference to $mosConfig_lang or $iso_client_lang to the template image code or style sheet.

Within a template this can look like:

<?php

$template = 'template_css.css';

$langTemplate = 'template_' .$GLOBALS['mosConfig_lang']. '_css.css';

if( files_exists( $mosConfig_live_site .'/templates/rhuk_solarflare_ii/css/' . $langTemplate ) )

{ $template = $langTemplate;}?><link href="<?php echo $mosConfig_live_site;?>/templates/

rhuk_solarflare_ii/css/<?php echo $template;?>" rel="stylesheet" type="text/css" />

This code loads the language depended Style Sheet as long a file like template_german_css.css exists.

You can do something similar with your image tags, here it is adviced to use different directories such as:

<?php

$imageDir = $mosConfig_live_site . '/templates/rhuk_solarflare_ii/

images';$langImageDir = '/' . $GLOBALS['mosConfig_lang'];if( dir_exists(

$imageDir . $langImageDir ) ) { $imageDir = $imageDir . $langImageDir;}?>

<img src="<?php echo $imageDir;?>/myimage.png">

 

0 Comments

Add Comment

Joom!Fish 2.0 RC download

Избрани сътрудници

От екипа на Джум!Фиш (Алекс, Герайнт, Иво & Робин), голямо благодарим към цялата Джум!Фиш общност. Специални благодарност за тестването, предложенията, преводите и модерирането към:

  • Томи Уай за сладкото лого
  • Бернхард, Майкъл, Люк, Оливие, Робин, Руне, Акаравут
  • Хари (Тасу) за модерирането

Recommended Reading

Buy Joomla! 1.5 with directshopper