|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Hi,
What is the best place to store templates? I mean in a database or in a directory? And why? Thanks .. |
|
#2
|
|||
|
|||
|
for a template, definetly a file. one file for top template and one for bottom template. storing them in a database just makes them hard to edit, and noramlly templates are files that you edit often.
|
|
#3
|
|||
|
|||
|
and I can recommend you one of the best template library: Smarty. Check them out you will get surprised how great/strong templating engine it is.
You can extend the engine easily. At first it can look diffucult but dont give up. And you can use files or databases easily for your templates with it IMHO |
|
#4
|
|||
|
|||
|
id say file, unless your moving your site every 5 minutes or changing something on it every 5 min, its best to have it in a dir, just one less thing in your db that you dont have to manage,
if your worried about someone finding the template and using it to somehow hack your site try this name your template with .php at the end in you template put something like this <?php if($template == "on") { ?> html code here <?php } ?> then when you call the template add this line $template = "on"; this way if someone finds the template and trys to load it they'll get a blank page! with none of your code at all! that measure is a bit drastic, but it works hehe |
|
#5
|
|||
|
|||
|
Like sylow mentions, Smarty is an excellent template system with heaps of flexibility... You can store your templates wherever you want and Smarty can cache the output for greater performance...
Check it out: http://www.phpinsider.com/php/code/Smarty/ or http://smarty.php.net/ |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > PHP: What is the best place to store templates (DB or DIR)? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|