Jump to content

Php Template System


rswildy

Recommended Posts

Well im writing some framework in PHP and i started on the template system after almost finishing i thought to myself whats the point.Why not just include PHP instead of HTML , Can anyone give me some good reasons to use a template system with things such as <-- if (condition) --> {login box} <-- end if --> When i could just simply use a PHP file.

Link to comment
Share on other sites

I'm not sure about the "if" stuff... but a teplating engine is good for producing "static" pages that have content that's dependant only by a few variables, which are replaced at the correct point.Why use a templating system in the first place? Makes pages easier to maintain. Should you want to change the layout or something (e.g. add an extra form field), you just edit the teplate file. Should you want to make PHP do something (e.g. validate that new form field, and submit it to a DB), you just create the required PHP script, and "hook" the field to it or vice versa.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...