RE: [SMARTY] Embedding variables into parameters for the {include} command

From: Date: Thu, 28 Aug 2003 19:02:10 +0000
Subject: RE: [SMARTY] Embedding variables into parameters for the {include} command
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10144@lists.php.net to get a copy of this message
You don't need brackets to access the variable, and I'm pretty sure you can't use a variable modifier while assigning. Try this instead: {include file="header.tpl" title_1="User Details ::" title_2=$name} ... <title>{$title_1} {$title_2|htmlentities}</title> ... -Marshall ____________________________________ "If at first the idea is not absurd, then there is no hope for it." - Albert Einstein -----Original Message----- From: Richard Jones [mailto:rj@last.fm] Sent: Thursday, August 28, 2003 3:42 PM To: smarty-general@lists.php.net Subject: [SMARTY] Embedding variables into parameters for the {include} command Hi all, I've been using smarty for a couple of months now, and i've run into an annoying problem.. i'm sure i'm missing an obvious solution.. I include a header atop each template, passing it the title to use in the html <title> tags the title is chosen depending on page content, for example: {include file="header.tpl" title="User Details :: {$name|htmlentities}"} except this doesn't work.. Fatal error: Smarty: [in user.tpl line 1]: syntax error: expecting '=' after attribute name 'Details' (Smarty_Compiler.class.php, line 1342) in /usr/local/lib/php/Smarty_Compiler.class.php on line 1824 omitting the {} around the embedded variable $name doesnt work either.. i just prints the "$name|htmlentities" literally There are occasions where i wish to use $userobject->getName() as part of the title parameter too.. any suggestions? Thanks, Richard -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.smarty.general (#10144) next »