Hello guys,
I have downloaded a template engine: Smarty templates (http://smarty.php.net), and learned how to use it -- and everything is fine now ..
It is a very huge and great system honestly .. and I bet they've spent whatever long time to make it available ..
I urgently need to separate the design from the code, and also I need to make template modification very easy for the administrators ..
Thus, I thought that defining a table in MySQL named (mytemplates) for exmple .. and assigning to this table different attributes like (template_name, template_id, tamplate_value,...etc) :
Let's take the following example, as a very simple template that only contains PHP and HTML:
"<B>Welcome $username to my homepage</B>"
Assume template_name="welcome_message"..
Whenever I need to use this template, I just query it ..
My debate is:
using MySQL to store templates is better than using template engines, for the following reasons:
1) You will not need to learn new things .. (assuming you know php & mysql)..
2) Modifying templates will be far easier, because you would not need to open files, which might not be always available under Unix .. due to chmod stuff .. You just need to manage them in a control panel.
3) Template engines are always subject to have bugs ..
4) Template engines are not standardized .. each one has its own style ..
I just wonder, what makes template engines important, if I can use MySQL? What things are available in these engines and not available if you store your (PHP & HTML & possible javascripts) in MySQL ?
Any ideas ..