Re: The use of templates

From: Date: Wed, 14 Feb 2001 12:15:37 +0000
Subject: Re: The use of templates
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-125@lists.php.net to get a copy of this message
Joris, Thanks for your reply; your suggested solution looks good. How about performance? Although my application is not performance-critical, I'm interested in what would be faster, and what the difference in speed would be? Thanks ! > -----Message d'origine----- > De : Joris Trooster / Interstroom [mailto:trooster@interstroom.nl] > Envoyé : mercredi 14 février 2001 12:48 > À : smarty@lists.ispi.net > Objet : [smarty] Re: The use of templates > > > > You don't have to use the Smarty template language. It is > possible to create > different (nested) templates, and use while loops in the php code. However > you will end up in much more templates and more php code, and > because of the > many templates, more difficult to understand than one template with the > simple Smarty template language. > > E.g. instead of a template like this: > > A list of names: > {section name=people loop=$FirstName} > {$people/FirstName}<br> > {/section} > End of list > > you can create two templates like this (bodytemplate.tpl): > > A list of names: > {$names} > End of list > > And (namestemplate.tpl): > > {$FirstName}<br> > > With the corresponding php code (example): > > while ($db->next_record()) { > $namestemplate->assign("FirstName",$db->f["FirstName"]); > $names .= $namedtemplate->fetch("namestemplate.tpl"); > } > $bodytemplate->assign("names",$names); > $bodytemplate->display("bodytemplate.tpl"); > > We think that it is much better to use the Smarty language. It's easy to > understand, and designers who know html don't have troubles with > the Smarty > language. However, you don't have to... It's up to you. > > Regards, > Joris > NL > > > --- > You are currently subscribed to smarty as: alain@nvision.lu > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/

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