Assigning to variables
| From: | Jake Stride | Date: | Wed, 18 Aug 2004 21:18:26 +0000 |
| Subject: | Assigning to variables | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-11705@lists.php.net to get a copy of this message | ||
I have had a look at the faqs and done a search on google, but can't seem to
solve this question.
I have a template that iterates over an array using a section, the problem
is that I would like to parse some of the variables so that I can use them
later on in the template. Below is a cut down version of the template:
{section name="view" loop=$view_data}
{if isset($view_data[view].newmodule)}<a
href="{$serverRoot}/?{$sessionName}={$sessionValue}&module={$view_data[v
iew].newmodule}&function={$view_data[view].newfunction}&sub={$view_d
ata[view].newsub}&type={$view_data[view].newtype}&view={$view_data[v
iew].newview}&id={$view_data[view].newid}"><img class="new"
src="{$serverRoot}/themes/{$theme}/graphics/news.gif"
alt="{$view_data[view].newname}" /></a>{/if}
{/section}
What I want to do is something like:
{section name="view" loop=$view_data}
{assign var="uselater" value="}<a
href="{$serverRoot}/?{$sessionName}={$sessionValue}&module={$view_data[v
iew].newmodule}&function={$view_data[view].newfunction}&sub={$view_d
ata[view].newsub}&type={$view_data[view].newtype}&view={$view_data[v
iew].newview}&id={$view_data[view].newid}"><img class="new"
src="{$serverRoot}/themes/{$theme}/graphics/news.gif"
alt="{$view_data[view].newname}" /></a>"}
{/section}
...
{$uselater}
Obviously this doesn't work so is there some way around this or do I need to
use another template?
Thanks
Jake