Re: challenging Smarty - componentized template
"Muhammed Mamedov" <[email protected]>
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <008c01c3f4de$84a70040$2101a8c0@mm> |
----- Original Message ----- From: "Marcus Bointon" <[email protected]> To: "Smarty dev" <[email protected]> Sent: Monday, February 16, 2004 1:18 PM Subject: Re: [SMARTY-DEV] challenging Smarty - componentized template > on 14/2/04 22:23, Muhammed Mamedov at [email protected] wrote: > > > But still having some questions with the general Smarty work principle, like > > for example "Is there a performance difference using {include file='dddd.tpl'} > > and {include_php file=''somephp.file}?" I am currently trying `smartize` my > > 100% ready and running PHP site and wonder if I have to transform my .php > > includes into .tpl files where possible, or including php directly in > > templates is also ok.. > > I don't know what the performance difference might be, because you probably > shouldn't be doing it anyway. Most of the point of Smarty is to keep code > out of your templates, or at least keep it to handling presentation logic > (which is what Smarty's logic is for), so you should not really ever need to > include a PHP file in your template. m@m : You say that it is weird to include php files into templates. Well, I found this way to handle componentized templates from Smarty's Manual:( Chapter 18. Tips & Tricks, Componentized Templates). They even provide an example there : index.tpl --------- {* Smarty *} {include_php file="load_ticker.php"} {* THIS IS THE WAY I DO MY PHP+TEMPLATE STUFF NOW *} Stock Name: {$ticker_name} Stock Price: {$ticker_price} What do you think?.. > > Including template components is an excellent way to work, I use it for > headers and footers etc. If you're regularly wanting to include PHP in your > templates, either you've got your logic mixed up, or you should perhaps look > at writing a Smarty extension... > What is extension? Can you describe in brief? I will also check that myself.. > Marcus > -- > Marcus Bointon > Synchromedia Limited: Putting you in the picture > [email protected] | http://www.synchromedia.co.uk > > -- > Smarty Development Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- Smarty Development Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php