NYCPHP Meetup

NYPHP.org

[nycphp-talk] Templating and design strategies

Joseph Annino jannino at jannino.com
Thu Sep 5 13:39:06 EDT 2002


I like vlibTemplate which can be found at:
http://vlib.activefish.com/

It uses a template syntax very close to the Perl module HTML::Template.
What I like about is that it is a very simple limited template language,
keeping you from doing things in templates you really should be doing in
your code, and so in doing keeps design and logic as separated as possible,
making it easier for clients to change their own templates if they so
choose.  This doesn't make it hard to use, as data is fed into the template
using simple associative arrays.  You can do loops and things too by either
making arrays of arrays, using some convenience methods, or just passing it
a database result.  It can recursively include other templates, and that
works with relative pathnames, so if you set up your directories properly,
you can have header information, etc change as you move files around.  It
also provides subclasses that can provide useful debugging information, or
compile and cache the templates for speed.

An added plus for me is being able to use the sample templates in Perl or
PHP.  I use both a lot, often in the same project, as each language has its
own strengths.

On 9/4/02 4:15 PM, "Mike Myers" <myersm at optonline.net> wrote:

> 
> What are some good ways to manage hierarchical templates when using
> Apache/MySQL/PHP?
> 
> I am accustomed to Frontier's approach, where a site and its sub-directories
> are contained within a hierarchical object database. This made it very
> natural to have layout and boilerplate items which apply selectively,
> depending upon where a given web page exists in the hierarchy, or what
> server directives are present. Conditionally grabbing something from the
> object database was very easy to do. The bulk of the page rendering involved
> replacement of placeholder strings with database values.
> 
> OTOH, I felt cramped using Frontier, because I had often had to figure out
> how to work within the framework to achieve customized effects.
> 
> Using MySQL to store such components seems like overkill. Do most php
> developers use a file-based strategy coupled with include, require, or
> fileio methods.?
> 
> Another option is Dreamweaver MX, which has a template framework. It seems
> to have a crude system for conditional components ('optional region'). I
> have experimented a bit with Dreamweaver's web application framework for
> PHP/MySQL, and my first inclination is to NOT become overly dependent on the
> Dreamweaver way of doing things. Moving data from a MySQL table into a basic
> HTML table is easy, but doing things that break the simple mold might get
> cumbersome. Granted, I've only tinkered with it for a few days.
> 
> Are there some "common practices" out there, or perhaps website frameworks
> for PHP that don't have a 6 month learning curve?
> 
> Basic Example:
> 
> The layout of the info flowing through the different "topics" below is
> roughly similar. But the specific navigation bars, jump menus, and other
> elements of the page margins are specific to each topic. The customized
> aspects could be in a database or defined within preference files located at
> various levels of the site.
> 
> site
>   topic_1
>      category_1
>      category_2
>      category_3
>   topic_2
>      category_1
>      category_2
>  
> Not such a great example, I hope people get my point.
> 
> 
> 
> --- Unsubscribe at http://nyphp.org/list ---
> 
> 
> 




More information about the talk mailing list