On Wed, 2009-03-04 at 15:21 -0800, Michael A. Peters wrote: > Robert Cummings wrote: > > > > > To punt what is repeated over and over during runtime to a single > > compilation phase when building the template target. To simplify the use > > of parameters so that they can be used in arbitrary order with default > > values. To allow for the encapsulation of complex content in tag format > > that benefits from building at compile time and from being encapsulated > > in custom tags that integrate well with the rest of the HTML body. > > > I can't speak to those (and I have no opinion on template systems having > never used any of them. > > > To > > remove the necessaity of constantly moving in and out of PHP tags. > > php does not require that you constantly move in and out of PHP tags. > There's at least one and possibly several pure php solutions that allow > one to never write a line of html but get beautiful dynamic html output.
It doesn't require, but if you're not moving between them, then you're probably echoing your HTML, and that can be a maintenance nightmare. > > To > > speed up a site. > > I'm curious about that one, how so? What need not be rendered at runtime because it was rendered at compile time saves that exact amount of time per page. When you include your header, include your footer, include your sidepanel, etc... these are all run-time hits. Primary navigation, secondary navigation, top bar navigation, etc etc. These can all be pre-rendered and pre-rendered contextually for each page to indicate which menu item corresponds to the current page. Here's what I do for a menu: <jinn:menu title="" name="primary-nav" accumulators="true" expand="active"> <item caption="Logout" href="//logout.php" testVisible="userIsLoggedIn()" /> <item caption="Home" href="//index.php" matchActive="^index.php" /> <item caption="Mandate" href="//about-us/mandate/index.php" matchActive="^about-us/mandate/" /> <item caption="Panel Members" href="//about-us/panel-members/index.php" matchActive="^about-us/panel-members/" /> </jinn:menu> That's how I do menus, the tags and CSS is all then generated at compile time. The match active regex is run at compile time against the page being generated. The only thing that gets executed at run-time is userIsLoggedIn() and that determines if the menu item is displayed, but all the tags and CSS classes have already been pre-generated from this very simple declaration. Similarly I have tags for embedding media, images, etc. When I include an image tag, at compile time the width and height of the image are determined and expanded into the HTML <img> tag. There's lots of things developers do that costs them on every page load. I punt the unnecessary stuff to the compile stage. For some pages, ones that don't require any PHP logic, I can output a static HTML page that never invokes the PHP parser, all with the same look and feel built at compile time. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php