Hello!
In a previous post I wanted to create a general website template (header, footer, left_col, right_col) for a website using the includes() command, and be able to "push" my various content into the appropriate sections.
Smarty was suggested as a great template system. However, Smarty seems like it is overkill for what I want. And in addition to that, it just adds on another language that I would need to learn. Is there any simple way to create a class that pulls in the appropriate html code files for the various parts of my template?
Thanks everyone,
Matt
Smarty template system VS simple php class
Moderator: General Moderators
Re: Smarty template system VS simple php class
I wrote an article on the subject a while ago, might be relevant for you - http://www.techfounder.net/2008/11/18/o ... emplating/
Re: Smarty template system VS simple php class
Pytrin!
This is exactly what I have been endlessly looking for. It is especially nice if one is used to OOP with C, VB, etc.
Also, very well written article. You eloquently framed OOP within PHP. This is a great starting tutorial for anyone wanting to build their own template classes from the bottom up, as opposed to using a class like Smarty, which has many great features but is overkill for a lot of people.
For any beginners out there, you need to add in the line "require (view.class.php);" in the example index.php, where view.class.php is the class file you created, otherwise the class will not be recognized.
Thank you so much.
Cheers,
Matt
This is exactly what I have been endlessly looking for. It is especially nice if one is used to OOP with C, VB, etc.
Also, very well written article. You eloquently framed OOP within PHP. This is a great starting tutorial for anyone wanting to build their own template classes from the bottom up, as opposed to using a class like Smarty, which has many great features but is overkill for a lot of people.
For any beginners out there, you need to add in the line "require (view.class.php);" in the example index.php, where view.class.php is the class file you created, otherwise the class will not be recognized.
Thank you so much.
Cheers,
Matt