Assigning to variables

From: 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}&amp;module={$view_data[v iew].newmodule}&amp;function={$view_data[view].newfunction}&amp;sub={$view_d ata[view].newsub}&amp;type={$view_data[view].newtype}&amp;view={$view_data[v iew].newview}&amp;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}&amp;module={$view_data[v iew].newmodule}&amp;function={$view_data[view].newfunction}&amp;sub={$view_d ata[view].newsub}&amp;type={$view_data[view].newtype}&amp;view={$view_data[v iew].newview}&amp;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

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