HTML & CSS
Not sure where to post this
What is everyone's opinion on using "templating systems"?
I am reading a book on PHP and the author is using Smarty, and I find it extremely difficult to follow and understand.
The author makes it sound like Smarty will make the website easier to develop and maintain, but I just don't see how. :-/
This is one time where I feel like I am going backwards after reading a book... :unhappy:
Some guru advice/wisdom is definitely needed!!!
The concept is basically that the template for the page is kept as separate as possible from the PHP that defines how the page works. That means that the template can be easily modified completely independently of the PHP and so is far easier to maintain than if the template and PHP are jumbled together.
Smarty is just one particular way that has been developed for creating this separation. Anything where you write the template using HTML with markers in it where the content is to be substituted and then have PHP that reads in the HTML with markers and replaces the markers with the content will achieve the same end result so the only advantage Smarty has is that it is already written and so saves you having to write the PHP for it yourself.
Of course any other server side language can be used for it as well instead of PHP if the particular templating system is set up to use that language.
I understand the concept of inserting variables into database forms, web pages, etc. to separate the presentation from logic, but the way this author does things seems loopy?!
It is hard to explain things without you reading the book I'm working from, but between using object-oriented code and Smarty, things seem very complicated.