Re: [SMARTY] include from section

From: Date: Sun, 12 Jan 2003 20:18:17 +0000
Subject: Re: [SMARTY] include from section
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7137@lists.php.net to get a copy of this message
try this: {section name=x loop=$y} {assign var=fn value=$y[x]} {include file="$fn.filename"} {/section} will include files named "something.filename" from your $y array .. thing is, array referencing doesn't work within a string expression, so you first have to assign the value of your element to a single variable. --- At 2003-01-12, 18:35:00, Ivan Voras <ivoras@fer.hr> wrote: >I'm trying to include files whose filenames are stored in a database. The >obvious way (at least to me...) would be: > >{section name=x loop=$y} >{include file=$y[x].filename} >{/section} > >But this (in many variations) only causes various error messages, or even >garbage to be generated. Errors happen even when the $y variable above is >empty (an empty array), so it looks like the {include...} is not validated >like a normal part of a script, but it is pre-processed (?). > >Is it possible to do something like the code above in Smarty? > >-- >-- >Do not meddle in the affairs of sysadmins, for they are quick to anger and >have not need for subtlety. > > >-- >Smarty General Mailing List (http://smarty.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php

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