Re: Template system in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Feb 12, 2008 4:45 PM, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:

> > well thats what xslt is, which is pretty nice.
>
> Nah, I don't bother with XSLT.


i know, i just thought id mention it, since xml was brought up and nobodys
even mentioned xslt yet.
i will likely move away from xslt, but i will be doing something different
than
the straight php based templating, like in code igniter.  thats great for
simple
projects, but the thing i hate the most is escaping in and out of php, bleh!
im still experimenting w/ my solution so i wont bother to share it until its
worth
looking at, but for the meantime the basic php mechanism is suitable.
and i certainly dont use eval()!  its slow and it opens holes to attacks.
the most simple, way to template w/ php is w/ php, very simply, you will
have a
file, blah.php
and watch how i include another 'template' after the data portion, (the
second template
is blah2.php

<someHtmlTag>
<?=$someDataFromPhp?>
<?php include('blah2.php'); ?>
</someOtherHtmlTag>

and there you have it, that is the most direct way to template w/ php,
backed by the
language itself.  there is no need for eval either.  i have my reasons for
not liking it,
but as i said, my system is far from ready and well this is cleaner than
writing functions
with strings, thats just horrid, imho.

whwe, rant finished :)

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux