Jump to content

php template engine


joshman13

Recommended Posts

hello everyone,
i am looking at building a lightweight template engine for some of my
scripts that i am using. i have looked into several different ones, and
although many have great features, none have exactly what i am looking
for. the main thing i haven't liked is that most of them use
{placeholder} style tags, which creates unnecessary overhead, because
php itself is a template language, so why create a wrapper for
something that already does the job?

for most of the pure php template classes, this is what i've seen for
the most part:

: assign variables that replace content
: start an output buffer
: include the template file
: store the rendered content of the template file in a varable
: clear the output buffer
: return the rendered content

i really like this format just because it allows sub-templates in a
main file. for instance, i can have a template file for the complete
shell, but then have another file to include everytime i want a table,
or a menu, or anything modular like that.

i was thinking about this though, and basically the entire page is
stored in a variable before the output is ever sent to the screen. are
there any drawbacks to doing it this way? what about speed and memory?
are there better ways to go about it?
Link to comment
Share on other sites

  • 5 years later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.