Contao Open Source CMS > Contao forum

Switch to german forum

Index > Feature request > A new insert tag {{env::page_lang}}

cyril
User
Avatar
Posts: 429
Valence, France
Hi Leo,

I have a french site with dynamic background images.
Now, I want to create an english version (in the future maybe more languages), and if possible don't create new layouts. I want to organize my 'images' folder by language.

Example of what I have in my layout :

iconCode:
<style type="text/css">
#container {
	background-image: url(/tl_files/images/fr/backgrounds/{{env::page_alias}}.jpg);
}
</style>

Example of what I want :

iconCode:
<style type="text/css">
#container {
	background-image: url(/tl_files/images/{{env::page_lang}}/backgrounds/{{env::page_alias}}.jpg);
}
</style>

If you don't want to add this feature in the core, is it possible to tell me what I can change to do this ?
2008-02-07 09:27
leo
Administrator
Avatar
Posts: 7026
Wuppertal, Germany
Hi Cyril,

style sheets are not parsed by the PHP interpreter, therefore that is impossible to accomplish, I am afraid :-( If at all, you can probably develop a JavaScript based solution.

Regards
Leo
2008-02-07 10:26
cyril
User
Avatar
Posts: 429
Valence, France
Hi Leo,

I think you read my previous post too much quickly ;)
My problem is not the css, my css code is in a layout and works, I want just add the language code dynamicaly, that's all...
2008-02-07 10:33
leo
Administrator
Avatar
Posts: 7026
Wuppertal, Germany
Hi Cyril,

you are right :-) I am sorry. The good news is that there is a way to accomplish it already.

iconCode:
<style type="text/css">
#container {
    background-image: url(tl_files/images/fr/backgrounds/<?php echo $this->language; ?>.jpg);
}
</style>

Regards
Leo
2008-02-07 10:46
cyril
User
Avatar
Posts: 429
Valence, France
Hi Leo,

It's so simple, I not thought of this, sorry :|

Thanks Leo,
2008-02-07 11:00