Re: [PHP Template] Includes in templates
| From: | Peter Andreasen | Date: | Wed, 29 Mar 2000 22:08:26 +0000 |
| Subject: | Re: [PHP Template] Includes in templates | ||
| References: | 1 2 | Groups: | php.template |
| Request: | Send a blank email to php-template+get-493@lists.php.net to get a copy of this message | ||
Andrei wrote:
> So, you want to include another template and pass values to it? Can I
Exactly.
> ask why you would want to pass headlines to a subtemplate? Seems like
> that should be coming from the PHP script.
No, because it is might not be dynamic data. Let's say I throughout my
site use the following whenever I need a nicelooking headline:
<table width="100%" border=1 bgcolor="black" cellpadding=4>
<tr><td>
<font color=white size=2>
This is a headline
</font>
</td></tr>
</table>
While I could just type in the whole thing every time, it would be so
much easier for me to just write
{ include niceheadline.tpl ('headline' => 'This is a headline') }
instead. Optimally I could even write
{ include niceheadline.tpl ('headline' => '{$dynamic_headline}') }
_if_ my headlines came from some logic (in php).
I know of quite a few web-designers who use php only to be able to do
this in a non-template fashion, that is:
function niceheader($headline) {
print "....$headline....";
}
and then throughout the .php3 pages:
<?php print niceheader('This is a headline'); ?>
just to save some typing and be able to change the look throughout the
site at the snap of your fingers. This is actually like a stylesheet
thing that can do much more than your average CSS.
But it would be quite natural to use templates for this..
Does it makes sense?
- peter
--
ln -s /dev/random ~/.plan