[ciapug] Templating System
Tony Bibbs
tony at tonybibbs.com
Fri Jun 24 09:15:28 CDT 2005
Not sure what you mean by "PEAR template system".
PEAR has a number of template systems:
1) IT
2) PHPLib
3) Xipe
4) Sigma
5) Flexy
See http://pear.php.net/packages.php?catpid=10&catname=HTML&pageID=2 for
more on each.
Discussions on template engines can turn personal quickly so the thing
to remember is:
1) Use one only if you really need it
I have a few system that require themeable sites and that along with the
tendency of putting too much PHP code in PHP-based templates has
prompted me to use Flexy which handcuffs how much logic you can put into
a template
2) If you use a template system, use one that compiles. The IT and
PHPLib ones are great examples of slow memory intensive templating systems.
Our group has decided on Flexy mainly because it supports
PEAR::Translation2 natively.
Keep in mind I'm only offering guidelines and the logic I used to get
where I'm at now. I'd like to think I'm unbiased and could have arrived
at a different decision given different needs.
--Tony
Jerry Weida wrote:
> I think just about anyone will agree that the PEAR template system is
> lacking and sluggish at best.
>
> I favor the Smarty template system. It has always worked very well for
> me in the past and it allows you to choose the complexity of the
> tempaltes you write as it can handle some PHP in the template itself.
> The built in caching system makes it extremely fast as well.
>
> On 6/24/05, *Dave J. Hala Jr.* <dave at 58ghz.net <mailto:dave at 58ghz.net>>
> wrote:
>
> That's a good point. I'll buy that.
>
> However, if keep you it simple, you won't have that vulnerability. I
> think that a "template" like the one below is fairly safe. The Java
> script is couple of tools that format date/ssn & phone numbers on the
> fly.
>
>
>
> <html>
> <head>
> <title> <? echo $title ?></title>
> <meta http-equiv="Content-Type" content="text/html; <meta
> http-equiv="Pragma" content="no-cache">
> <script language="JavaScript" src="/java/ssn-date-phn.js"
> type="text/javascript" ></script>
> <style type="text/css">@import
> "../css/main.css";</style>
> </head>
> <body bgcolor="#ffffff" >
> <? echo $page ?>
> </body>
> </html>
>
> On Fri, 2005-06-24 at 08:25, Tony Bibbs wrote:
> > This best sums up why PHP isn't such a good template engine:
> >
> >
> http://www.akbkhome.com/blog.php/View/80/PHP+as+a+template+engine%2C+or+recipe+for+disaster%3F.html
> <http://www.akbkhome.com/blog.php/View/80/PHP+as+a+template+engine%2C+or+recipe+for+disaster%3F.html>
> >
> > In short, you have to save developers from themeselves sometimes.
> >
> > --Tony
> >
> > Dave J. Hala Jr. wrote:
> > > I was thinking about what Tim said the other day regarding
> "templating
> > > systems". I think the main point was: how is inserting a <? echo
> > > $content ?> tag into an html document really any differant
> than if you
> > > just inserted some if/then logic etc.
> > >
> > > I agree with Tim, its more or less the same thing. For me, the
> problem
> > > that I was trying to solve two-fold:
> > >
> > > 1. Seperate the dynamically generated content from the static
> content,
> > > so that an end user (or graphic designer) could edit the html
> without
> > > mucking around in the php code.
> > > 2. Make it user to make changes to the CSS include files,
> thereby making
> > > it simple to effect system wide cosmetic changes in the both
> the html
> > > and the dynamically generated content.
> > >
> > > Tim did you have something else in mind?
> > >
> > > :) Dave
> > >
> > >
> > >
> > >
> > _______________________________________________
> > ciapug mailing list
> > ciapug at cialug.org <mailto:ciapug at cialug.org>
> > http://cialug.org/mailman/listinfo/ciapug
> --
>
> Open Source Information Systems (OSIS)
> Dave J. Hala Jr. <dave at osis.us <mailto:dave at osis.us>>
> 641.485.1606
>
> _______________________________________________
> ciapug mailing list
> ciapug at cialug.org <mailto:ciapug at cialug.org>
> http://cialug.org/mailman/listinfo/ciapug
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ciapug mailing list
> ciapug at cialug.org
> http://cialug.org/mailman/listinfo/ciapug
More information about the ciapug
mailing list