Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
Skinning: Understanding A Template-Based System
Princeton
Join Date: Nov 2001
Posts: 6,693

Joe Velez began developing for the web in 1998. He is an avid vBulletin user and volunteers his services as a vbulletin.org administrator. He currently spends his time maintaining and developing allnurses.com.

Vineland, NJ
by Princeton Princeton is offline 21 Aug 2006
Rating: (1 vote - 5.00 average)

vBulletin uses a "template-based system" to render all web pages.

In order to modify the design of your site, you will need to first understand WHAT? and WHY? a template-based system.

WHAT IS A TEMPLATE-BASED SYSTEM?
First of all, a template-based system (eg. vBulletin) is not the same as "templates" purchased at monstertemplate.com.

Template-based system are files used by a particular program (eg vBulletin) that are not complete HTML files - they contain only parts of the HTML that the system puts together to build a web page.

WHY A TEMPLATE-BASED SYSTEM?
Templating is an easy way to create a web site without a lot of work in maintaining a consistent look and feel across the entire site. For example, all you have to do is modify a template and the modifications will reflect across every web page.

SHOW ME AN EXAMPLE
Are you still puzzled? OK, let's jump right in and play with an example.

Let's say, we have 2 sections in our site: Site Policies and Site Rules.
To render these sections, we have a total of 4 templates.

TEMPLATE 1 (Template Name: PAGE)

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

TEMPLATE 2 (Template Name: page_content)

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

TEMPLATE 3 (Template Name: page_footer)

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

TEMPLATE 4 (Template Name: page_sidebar)

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

When visiting each section, the script will build the HTML by using the variables for the specific page and putting the following templates together: PAGE + page_sidebar + page_content + page_footer

The title and content for each page is as follow:
Variables for our policy page:
$title= 'Site Policies';
$text= 'Hello world! This are my policies...';
Variables for our rules page:
$title= 'Site Rules';
$text= 'In order to participate you must follow our rules...";
The Site Policies page will look this when completed:
tut_temp.gif
(click on thumbnail to view content)

The Site Rules page will look this when completed:
tut_temp2.gif
(click on thumbnail to view content)

Now, just imagine this on a larger scale ... let's say 1000's of pages; and, you need to modify the copyright notice.

Well, with a template-based system, all you have to do is modify the page_footer template; and the changes will be displayed on all your pages! Now, isn't that great?

What a great way to save time. Time is money!

So you see, the idea behind a "template-based system" is that you only have to write the HTML 1 time; and, you can use it over and over again. It's similar to CSS (that's another tutorial) -- you only have to write it once and it affects the whole site.

Last edited by Princeton; 23 Feb 2007 at 19:50..
Views: 67740
Reply With Quote
Comments
  #2  
Old 23 Aug 2006, 15:16
smacklan's Avatar
smacklan smacklan is offline
 
Join Date: Mar 2005
Real name: John
very good info Princeton...thanks!
Reply With Quote
  #3  
Old 23 Aug 2006, 16:02
Princeton's Avatar
Princeton Princeton is offline
 
Join Date: Nov 2001
Real name: Joe Velez
appreciate the comments

hopefully, it can help someone new to "Skinning vbulletin"
__________________
Former vBulletin.org Staff Member

Latest Articles:
Liquid Layout = Less Ad Revenue?
How to Monetize Your Site
Improve Web Page Performance
How To Write For The Web


If it needs instructions, there's room for improvement.
Give users what they actually want, not what they say they want. And whatever you do, don't give them new features just because your competitors have them!
Reply With Quote
  #4  
Old 15 Oct 2006, 01:29
HPIA HPIA is offline
 
Join Date: Jul 2006
A good article leaves not a doubt in my mind. Good work!
Reply With Quote
  #5  
Old 20 Mar 2007, 14:05
Triky's Avatar
Triky Triky is offline
 
Join Date: Mar 2007
Location: [Italy]
Nice tutorial, Princeton.
__________________
I'm italian, I am learning english.. so, please, if you see any errors in my grammar or spelling, let me know via PM. Danke!
Reply With Quote
  #6  
Old 25 Mar 2007, 23:21
cdembek cdembek is offline
 
Join Date: Nov 2005
how are the templates stored.. I know they are stored in a DB but which table do they get stored in.. lets say the header, navbar and footer templates... good read.. thanks for the post
Reply With Quote
  #7  
Old 04 Apr 2007, 01:39
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Are you asking which database table holds the templates?
__________________
Please feel free to PM me about custom work, installations, and upgrades!

Eclipse Records - Streetcult Street Team
Reply With Quote
  #8  
Old 10 Apr 2007, 22:42
pappy1961 pappy1961 is offline
 
Join Date: Feb 2007
I for one would be VERY Grateful to Princeton for many more of those type explanations.

By the way Princeton, you have a frsh start newbie goin right here!!

Last edited by pappy1961; 10 Apr 2007 at 22:43. Reason: Automerged Doublepost
Reply With Quote
  #9  
Old 16 Apr 2007, 13:51
Princeton's Avatar
Princeton Princeton is offline
 
Join Date: Nov 2001
Real name: Joe Velez
thanks pappy ... when I have time, I'll write some new articles.
__________________
Former vBulletin.org Staff Member

Latest Articles:
Liquid Layout = Less Ad Revenue?
How to Monetize Your Site
Improve Web Page Performance
How To Write For The Web


If it needs instructions, there's room for improvement.
Give users what they actually want, not what they say they want. And whatever you do, don't give them new features just because your competitors have them!
Reply With Quote
  #10  
Old 16 Jun 2007, 02:58
mktrilogy mktrilogy is offline
 
Join Date: May 2006
Is there a way to change one style and it also changes other styles that u have? or my question is not the same as ur topic ?
Reply With Quote
  #11  
Old 18 Jun 2007, 14:33
Princeton's Avatar
Princeton Princeton is offline
 
Join Date: Nov 2001
Real name: Joe Velez
I have no idea what you are referring to.

But I'm going to say .. no, it has nothing to do with this topic.
__________________
Former vBulletin.org Staff Member

Latest Articles:
Liquid Layout = Less Ad Revenue?
How to Monetize Your Site
Improve Web Page Performance
How To Write For The Web


If it needs instructions, there's room for improvement.
Give users what they actually want, not what they say they want. And whatever you do, don't give them new features just because your competitors have them!
Reply With Quote
  #12  
Old 30 Sep 2007, 19:41
Pc 1203's Avatar
Pc 1203 Pc 1203 is offline
 
Join Date: May 2007
Real name: James
Originally Posted by cdembek View Post
how are the templates stored.. I know they are stored in a DB but which table do they get stored in.. lets say the header, navbar and footer templates... good read.. thanks for the post
I'm also wondering about that.

- Pc1203
Reply With Quote
  #13  
Old 07 Dec 2007, 14:56
S.McAvoy S.McAvoy is offline
 
Join Date: Nov 2007
Same here
Reply With Quote
  #14  
Old 09 Dec 2007, 10:13
pyd pyd is offline
 
Join Date: Feb 2005
Are there any complete "Walkthrouhgs" on how to create a complete style?
Reply With Quote
  #15  
Old 23 Apr 2008, 21:13
Jasem's Avatar
Jasem Jasem is offline
 
Join Date: Feb 2006
Location: www.menokia.com
Thank you very much
__________________
games
Forum Nokia
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 16:08.

Layout Options | Width: Wide Color: