RE: [PHP] templates with php
| From: | Andrew | Date: | Mon, 31 Jul 2000 19:30:06 +0000 |
| Subject: | RE: [PHP] templates with php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9250@lists.php.net to get a copy of this message | ||
Hmmm..
Well, I would like to make a 'template' system to handle consistent
architeture of a largish (1000 pages) site, and then store content in mysql
via form-based admin. This touches again on the need to let people admin
their own sites and manage content without coding in HTML or PHP or anthing
else. With a different template used for each type of layout (e.g. indexp
age, events page, product description page) then the amount of php coding
should be pretty minimal, and rely on databased content.
The question I have is how do you then associate each template with the set
of content that should be assembled to create each page? If I allow the
forms to edit or create associative 'data files' that contain this mapping,
e.g. so that a template parses variable definitions (as select statements)
when including the data file, I've now created a one-to-one mapping between
site pages and data files, and I lose much of the relational database
benefit.
So has anyone found a way to eliminate that 'datafile' completley, so that I
don't have to allow the forms to create associative mappings in static
files? Perhaps by storing the name of the page or the set of content items
in the same row, and then pulling this all into an array at runtime?
Sorry if this is vague; I'm trying to design what I need before coding it.
Best regards,
Andrew
-----Original Message-----
From: Chris Adams [mailto:chris@digitaria.com]
Sent: Monday, July 31, 2000 3:16 PM
To: php-general
Subject: Re: [PHP] templates with php
> I never understood why people are so insistent on using something like
> @title@ instead of <?title()?> at the cost of an order of magnitude of
> performance degradation.
I have to agree with this (or the alternate <?=$Title?>). PHP has a good
parser that a lot of people have spent time making very fast; it's much
better to use it than try to duplicate all of the necessary functionality on
your own (with all the debugging and performance tuning that would require).
It wouldn't even be possible to match performance within PHP and that's not
counting things you'll miss out on like the zend compiler and cache.
The templated systems I've built all use a template which is a PHP script
that happens to enjoy a number of predefined functions and variables. To be
brutally honest, if the people writing HTML can't handle a list that says
"put <?=$Title?> where the page's title should be displayed" they should be
sacked for gross incompetence. Unless you've got a really complicated site,
building such a list would take a few minutes and it's not necessary for
them to learn PHP to copy and paste a few characters.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net