Recursion, include, and {section}

From: Date: Tue, 30 Jul 2002 18:18:11 +0000
Subject: Recursion, include, and {section}
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5516@lists.php.net to get a copy of this message
Smarty folks, I'm using Smarty for the first time, and I like it a lot. I've run into a problem, though. I am trying to generate a tree-like display (for a forum posting list). I tossed around several ideas, then came upon the idea of recursively including a template. This seems to work fine. Here's a sketch of what I'm doing: ------file recurse.tpl----------- {* ... *} {section name=aloop loop=$subjects} {* ... *} {include file="recurse.tpl" subjects=$localvar} {/section} --------------------------------- Problem is, the template contains a named {section}, and the recursive include is inside that {section}. This results in nested sections with the same name. This is futzing up the loops, as the Smarty manual predicts. I could fix this if it was possible to set the name of a section to the value of a variable. I don't see a way to do this, though. Any help would be appreciated! Cheers, Ken -- Ken Yarnall Dept. of Mathematical Sciences Lebanon Valley College Assoc. Professor of Math and CS (717)867-6085 yarnall@lvc.edu

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