|
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 |
cellers Smarty Rookie
Joined: 16 Dec 2003 Posts: 17 Location: UK
|
Posted: Fri Jan 16, 2004 2:30 pm Post subject: Failing to embed a config variable in a string |
|
|
I wonder if anyone can tell me what I'm doing wrong here when I attempt to access a configuration file variable within a string:
Code: | <iss.conf>
cVersion = "v1.0"
<main_menu.tpl>
{config_load file="iss.conf"}
...
{include file="footer.tpl" title="Intranet System {#cVersion#}"} |
Running this I get the following error -
Fatal error: Smarty: [in main_menu.tpl line 37]: syntax error: expecting '=' after attribute name 'Students' (Smarty_Compiler.class.php, line 1441) in c:\php\Smarty\libs\Smarty_Compiler.class.php on line 2062
I've tried messing around with the code in various ways but can't get it to work.
Thanks in advance. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Jan 16, 2004 2:44 pm Post subject: |
|
|
You can't nest smarty tags.
Try this:
{include file="footer.tpl" title="Intranet System `$smarty.config.cVersion`"} |
|
Back to top |
|
cellers Smarty Rookie
Joined: 16 Dec 2003 Posts: 17 Location: UK
|
Posted: Fri Jan 16, 2004 2:56 pm Post subject: |
|
|
It works!!! Excellent!
***
Actually, I tried this earlier, but with ' instead of the ` character...
I've just discovered the location of the ` key on my keyboard.
Many thanks... |
|
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
|