|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Article Discussion: Database Templating Engine
Have you ever been annoyed by template engines that force you to keep your templates in flat files? Ever feel like that Content Management System you just created isn't as dynamic as you originally thought? If you have ever felt like this, you may benefit from having your templates in a database.
Read the full article here: Database Templating Engine |
|
#2
|
||||
|
||||
|
Whatever keeps you from using Smarty? It offers all the features you would ever need.
Also, you put the flatfile "feature" as a downside. Do you know about load issues of templates that come from a database? That might work with an average 20 visitors per day website, but not with a site that has to handle a lot more loads.
__________________
-- Till Klampaeckel http://www.HTMLCenter.com http://forums.HTMLCenter.com http://www.OOCenter.com If my posts are helpful, please me. ![]() |
|
#3
|
|||
|
|||
|
you can cache the templates once they're loaded.
__________________
Wedding Gifts | Web Development | Order Fulfllment | Supply Chain | E-Business | Add to 100 SEO Friendly Directories fast do it yourself |
|
#4
|
|||
|
|||
|
In the fetchTemplate function there is a mistake:
$Content = "echo " $Template[content] ";"; Must be: $Content = "echo ". $Template[content] .";"; Good luck and thanx! Cya Bjorn ![]() |
|
#5
|
||||
|
||||
|
I still don't get why the author doesn't use Smarty. This is like a tutorial to the 1000th database abstraction layer, which only supports MySQL (as seen on countless script directories).
![]() |
|
#6
|
|||
|
|||
|
I think that use template files in a template directory is better than use MySQL. If you need a tiny website it can be good, but if you need a large website with too HTML code, it will run too slow. If the traffic is so high the template files system will be slow too, but if you make a cache system the website will be ok.
|
|
#7
|
|||
|
|||
|
Why do you want to use database for templating? I see soo many problems with it. I don't like to overwork and database abstraction just looks like a lot of work. Here are the drawbacks I can think of
-- You will need an interface to edit/add/delete templates (I hate writing interfaces where it is not necessary, IMHO its a overkill) -- You need to have a database up and running for the site to be up. -- Unnecessary database connections each time you load the page ... This will become a problem when thousands of people are viewing your page at the same time. Suggestion : Use flat files for templating. They don't need wrappers for editing, adding templates. Smarty might be a good choice. But I personally use XTemplate.... .Smarty is a whole scripting language by itself. XTemplate and simple, adequate and smart. Dawa |
|
#8
|
|||
|
|||
|
Smarty's scripting
Agreed that Smarty is too script-happy to the point that it acts as an entirely new language, introducing unnecessary complication and training.
Flat file templates also make development a bit easier when you can test out new designs and modifications on the fly instead of having to do SQL statements to change templates. |
|
#9
|
||||
|
||||
|
Quote:
While Smarty certainly requires more attention and a much steeper learning curve, I personally enjoy the freedom it brings when you can seperate backend code and frontend code, while giving space to the frontend developer at the same time, without giving him the tools to screw everything up. ![]() |
|
#10
|
|||
|
|||
|
Originally myself and a friend bought several template scripts for some of our sites, including one of our main ones lyrics dump, and then eventually just fell back on a custom-coded one-in-all script which operates the whole site from the same design and database interaction code. But if you insist on using a pre-coded template script I would recommend looking around on the resource sites (such as devshed's very own scripts dot com ) for free solutions first though. There's a lot of good, free stuff out there, so look around before coughing up the cash. Or alternatively just find a php/mysql wizz to partner yourself with, like I did. hehe.
|
|
#11
|
|||
|
|||
|
Quote:
I've actually now started to look at content management systems to design around, as there were going to be multiple users viewing, moderating, and visiting the sections involved. Having a built-in CMS like that really locks you into whatever development/templating language they have, but it really does save you a lot of hassle. Unfortunately, there are a lot of choices and I still don't know what's best out there, because I need something flexible enough to still include PHP logic (I have to allow users to enter scores and player statistics into a hockey league database). It's gone slightly off topic, but CMS' reflect a valid alternative that people could be using as opposed to db-templates. |
![]() |
| Viewing: Dev Shed Forums > Other > Development Articles > Article Discussion: Database Templating Engine |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|