|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Lloyd Smarty n00b
Joined: 04 Nov 2009 Posts: 1
|
Posted: Wed Nov 04, 2009 12:54 am Post subject: Will Smarty version 3 support use of tags in css and javascr |
|
|
Hi
Will Smarty version 3 support use of tags in a external css and javascript file, which is then icluded in the header portion of my template. An example is when I have a tag {images_dir} which is set to the location of the images used in my templates.
In css I would like to use this tag as follows:
body {
background-image: url ({images_dir}background.png) ;
}
I hope I have explained my question properly.
Thank you,
Lloyd |
|
Back to top |
|
schildi Smarty Regular
Joined: 11 Mar 2005 Posts: 81
|
Posted: Wed Nov 04, 2009 7:10 am Post subject: hi |
|
|
why dont you put all your file-path-related css-definitions in a
Code: | <style type="text/css">[...]</style> |
and put that into an extra template that you include in your header template?
i do it like that.
in smarty 2.x you just have to enclose the style-definitions with a {literal}{/literal} smarty-tag. and do it the other way round for the template-vars you want to use. thats it.
example [header_css.tpl]:
Code: | <style type="text/css">
{literal}
body {
background-image: url ({/literal}{$images_dir}{literal}background.png) ;
}
{/literal}
</style> |
in smarty 3.x you even can omit that {literal}-tag, if you have at least 1 space between a "{" and the following code |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Nov 04, 2009 5:00 pm Post subject: |
|
|
This would be simpler than literal if you need smarty tags within:
Code: | <style type="text/css">
body {ldelim}
background-image: url ({$images_dir}background.png) ;
{rdelim}
</style> |
and with Smarty 3, no literal escapement required. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|