Re: [SMARTY] Assign a template to a variable....

From: Date: Mon, 27 May 2002 18:28:15 +0000
Subject: Re: [SMARTY] Assign a template to a variable....
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4406@lists.php.net to get a copy of this message
So you want a template that behaves differently under different conditions but you have a policy against using conditionals? Why can't a "template" contain an if statement. Any template designer who understands that web pages are code and not just DW buttons should be able to use it easily. A non-conditional alternative (if one could be written) would always be much more complicated because it would be a hack around the language features. If you provide good tutorials with examples of how if statements work then people will learn. If this isn't the reason why you don't want if statements then tell us a bit more about your situation. Ben Godfrey On Monday, May 27, 2002, at 07:12 PM, Gandalf wrote:
Hello! I have been trying to find out how to do this for nearly half a day now, but i failed. Let's say i have a file called index.tpl. And i also have a file which contains a form called form.tpl. Now i want the form to be in my index.tpl so index.tpl would look like this: <html> blah blah <table blah blah> <tr> <td> {$form}</td> <tr> </table> ..... And i do not want the form to be displayed all the time, rather i want the form to be shown only if $form is TRUE, else it should display a nonbreakingspace (&nbsp;). So my two questions are: How can i display a template inside a template and also how can i tell the template index.tpl to show either the form or a nonbreakingspace WITHOUT having to use smarty's {if} {else} etc.. functions (cause the second i have to do that, it is IMHO not a template anymore, no offence taken). I downloaded the docu as a .pdf file and looked through it what seemed to be forever, but either i totally overlooked it, or what i want is not possible, which i dought very much :) Any help or tips, hints would be appreciated. Thanks a lot in advance! Best regards from Vienna, Jürgen Hauser
Jürgen (aka. Frodo the scribe ====================== Visit the MECCG Forums at http://www.coen.at.tf


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