Development Articles
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherDevelopment Articles

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 11th, 2004, 08:43 AM
Admin Admin is offline
Developer Shed
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Posts: 961 Admin User rank is Sergeant Major (2000 - 5000 Reputation Level)Admin User rank is Sergeant Major (2000 - 5000 Reputation Level)Admin User rank is Sergeant Major (2000 - 5000 Reputation Level)Admin User rank is Sergeant Major (2000 - 5000 Reputation Level)Admin User rank is Sergeant Major (2000 - 5000 Reputation Level)Admin User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old May 12th, 2004, 08:43 AM
Klimpong's Avatar
Klimpong Klimpong is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: Berlin, Germany
Posts: 350 Klimpong User rank is Private First Class (20 - 50 Reputation Level)Klimpong User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 5 m 14 sec
Reputation Power: 8
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.

Reply With Quote
  #3  
Old May 12th, 2004, 10:57 PM
dejaone dejaone is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 300 dejaone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 7 m 22 sec
Reputation Power: 5
you can cache the templates once they're loaded.

Reply With Quote
  #4  
Old May 13th, 2004, 07:13 AM
neutcomp neutcomp is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: The Netherlands
Posts: 10 neutcomp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to neutcomp
Cool small mistake!

In the fetchTemplate function there is a mistake:

$Content = "echo " $Template[content] ";";
Must be:
$Content = "echo ". $Template[content] .";";

Good luck
and thanx!

Cya
Bjorn

Reply With Quote
  #5  
Old May 13th, 2004, 07:18 AM
Klimpong's Avatar
Klimpong Klimpong is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: Berlin, Germany
Posts: 350 Klimpong User rank is Private First Class (20 - 50 Reputation Level)Klimpong User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 5 m 14 sec
Reputation Power: 8
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).

Reply With Quote
  #6  
Old May 13th, 2004, 11:33 AM
elvilla elvilla is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 1 elvilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 20 sec
Reputation Power: 0
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.

Reply With Quote
  #7  
Old May 14th, 2004, 10:50 AM
dawalama dawalama is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Location: NY
Posts: 1 dawalama User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Cool Let's not complicate things

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

Reply With Quote
  #8  
Old May 24th, 2004, 12:36 PM
d0hboy d0hboy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 6 d0hboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #9  
Old May 24th, 2004, 01:26 PM
Klimpong's Avatar
Klimpong Klimpong is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: Berlin, Germany
Posts: 350 Klimpong User rank is Private First Class (20 - 50 Reputation Level)Klimpong User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 5 m 14 sec
Reputation Power: 8
Quote:
Originally Posted by d0hboy
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.


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.

Reply With Quote
  #10  
Old July 12th, 2004, 09:03 AM
GonePhishing GonePhishing is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 10 GonePhishing User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #11  
Old July 12th, 2004, 03:32 PM
d0hboy d0hboy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 6 d0hboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb

Quote:
Originally Posted by GonePhishing
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.

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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherDevelopment Articles > Article Discussion: Database Templating Engine


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |