PHP Framewor and PHP Template Engine

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
colin_ldp
Forum Newbie
Posts: 3
Joined: Thu Nov 18, 2004 10:05 pm
Location: London

PHP Framewor and PHP Template Engine

Post by colin_ldp »

what's the difference between PHP Framewor and PHP Template Engine?

Are Template engines included as part of a framework???

please help me,

thanks a lot !
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

A template engine usually renders HTML-Templates, e.g. it writes values from a database into a predefined, static layout (the template).

A framework is usually a set of developer tools to facilitate and speed up application production. Whether or not template engines are part of a framework is entirely optional.
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

As Patrik mentioned, a template engine is solely concerned with presentation. A script defines a bunch of data and passes it to the template engine for display.

A framework is maybe best understood in comparison with a library. A library is a bunch of simple tools which you can use in any way you like. A framework solves some of the design problems of application building and you must fit your application into this structure. Framework components will have been designed to work smoothly together and may or may not work outside the framework environment.

Which parts of your own code are "library" or "framework" is kind of an interesting design issue. As a rule I try to refactor any framework stuff out of classes as much as possible. The fewer assumptions objects make about the environment in which they are called the better.
colin_ldp
Forum Newbie
Posts: 3
Joined: Thu Nov 18, 2004 10:05 pm
Location: London

Post by colin_ldp »

Thank you your answers.
But I also can't understand it exactly,
could you please give me more detail.

A framework is an integrated set of components that collaborate to provide a reusable architecture for a family of related applications. An MVC Framework helps us build applications using the MVC pattern.
for example: PHP.mvc, Mojavi, PRADO ...

Template Engine is used to separate presentation layout and style from view logic.
for example: Smarty or WYSIWYG HTML editors???
colin_ldp
Forum Newbie
Posts: 3
Joined: Thu Nov 18, 2004 10:05 pm
Location: London

Post by colin_ldp »

I hope i can handle it exactly, could you guys give me some examples concerning the very popular framework and template engines.
Post Reply