Re: [SMARTY] RE: Assigning to variables

From: Date: Thu, 19 Aug 2004 07:10:35 +0000
Subject: Re: [SMARTY] RE: Assigning to variables
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11707@lists.php.net to get a copy of this message
Thanks this should work, but how would I go about concatinating the output to another value? Ie I want to build up a string: $var = $var1.$var2; {section name=dataloop loop=$data} {capture name="cap"} {$data[dataloop].FOO} {/capture} {$catCap|cat:$smarty.capture.cap} {/section} {$catCap} On 18/8/04 10:44 pm, "Lambert, Patrick" <Patrick.Lambert@noggin.com> wrote: > Capture should work... > > http://smarty.php.net/manual/en/language.builtin.functions.php#LANGUAGE.FUNC > TION.CAPTURE > > You can dynamically name your capture by concatenating the section index > value into it.... > > {section name=dataloop loop=$data} > {capture name="cap"|cat:$smarty.section.dataloop.index} > > {$data[dataloop].FOO} > > {/capture} > {/section} > > {$smarty.capture.cap0} > {$smarty.capture.cap1} > > p. > >> ---------- >> From: Jake Stride >> Sent: Wednesday, August 18, 2004 5:18 PM >> To: smarty-general@lists.php.net >> Subject: Assigning to variables >> >> 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 (#11707) next »