Lost Password?


Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-30-2008, 09:37 AM
vedran's Avatar   
vedran vedran is offline
Newbie
 
Join Date: Aug 2008
Posts: 18
Rep Power: 1
vedran is on a distinguished road
Default Creating template system for my own cms

I'm making very simple cms, and haven't gone really far, but right now, I need to know, how can I make template system for a simple cms (so users can change template of the site). Do you know how to do that, or do you at least know tutorial or site, which could help me?

Thanx in advance...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-30-2008, 11:53 AM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 9,203
Last Blog:
Ext JS or Ext GWT
Rep Power: 20
Jordan is just really niceJordan is just really niceJordan is just really niceJordan is just really nice
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default Re: Creating template system for my own cms

This depends, largely, on how you have built your CMS. You can make it as simple as including a header and footer on every page and the user could change these (this is how vBulletin works). You could pass all data to a template file that simply extracts and uses what data it needs (this is how Joomla! works). You could take a look at the smarty framework and replicate their template system (they use a bunch of .spl files or something similar that is very irritating to work with).

There are many more methods. John may tell you his method that he uses for his CMS.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-30-2008, 12:49 PM
morefood2001's Avatar   
morefood2001 morefood2001 is offline
Guru
 
Join Date: Jan 2008
Location: Western New York
Posts: 1,415
Last Blog:
VPS Hosting with Revie...
Rep Power: 16
morefood2001 is just really nicemorefood2001 is just really nicemorefood2001 is just really nicemorefood2001 is just really nice
Send a message via AIM to morefood2001 Send a message via MSN to morefood2001 Send a message via Yahoo to morefood2001 Send a message via Skype™ to morefood2001
Default Re: Creating template system for my own cms

Quote:
Originally Posted by Jordan View Post
There are many more methods. John may tell you his method that he uses for his CMS.
I am not 100% sure what we are doing right now to include templates, but the last I knew we were storing data in a database on what to gather for each page like headers, footers, widgets, modules, etc. John will be able to elaborate much more than I can. I know that we are implementing the model view controller design pattern.
__________________
Phil Matuskiewicz
My Personal Website My Other Website
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-30-2008, 05:24 PM
orjan's Avatar   
orjan orjan is offline
Programming Professional
 
Join Date: Sep 2007
Location: Sunne, Värmland, Sweden
Age: 33
Posts: 328
Last Blog:
Procedural Programming...
Rep Power: 9
orjan has a spectacular aura aboutorjan has a spectacular aura aboutorjan has a spectacular aura about
Default Re: Creating template system for my own cms

I actually use smarty as a template engine as it's called,and I'm very pleased with it.
it uses .tpl files and contains all the html and info from the actual page sent by a special variable system.

the main thing is that you can do different tpl:s for the same page, and as you write your output in the tpl, you can have a large setup of themes as many cms:es call it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-31-2008, 07:39 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default Re: Creating template system for my own cms

Smarty is has to be one of the most asinine creations I know of. What the hell good is using a custom syntax just to run every tpl file through a smarty defined parsing function to convert that custom syntax back to php? That defeats the entire purpose of php to begin with.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 09-01-2008, 01:43 AM
vedran's Avatar   
vedran vedran is offline
Newbie
 
Join Date: Aug 2008
Posts: 18
Rep Power: 1
vedran is on a distinguished road
Default Re: Creating template system for my own cms

Quote:
Originally Posted by John View Post
Smarty is has to be one of the most asinine creations I know of. What the hell good is using a custom syntax just to run every tpl file through a smarty defined parsing function to convert that custom syntax back to php? That defeats the entire purpose of php to begin with.
So John, could you please explain me which would be the best and most common way to create template feature for my cms, everyone seems to think you're the best
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 09-01-2008, 02:56 AM
orjan's Avatar   
orjan orjan is offline
Programming Professional
 
Join Date: Sep 2007
Location: Sunne, Värmland, Sweden
Age: 33
Posts: 328
Last Blog:
Procedural Programming...
Rep Power: 9
orjan has a spectacular aura aboutorjan has a spectacular aura aboutorjan has a spectacular aura about
Talking Re: Creating template system for my own cms

Quote:
Originally Posted by John View Post
Smarty is has to be one of the most asinine creations I know of. What the hell good is using a custom syntax just to run every tpl file through a smarty defined parsing function to convert that custom syntax back to php? That defeats the entire purpose of php to begin with.
Well, how would a template engine work otherwise, if not being a mid-layer in between the produced data and the finished html?

in this way, you can, with the same code, in an very easy way, make totally different layouts with the same data, even for two users at the same time.

maybe there are better template engines, That I can't tell, but I've found the smarty engine to work well for me, then I can create my coding, and then a designer can work with the tpl-files how they like without disturbing the code at all, just inserting variables (and a few control parameters) into their design-html-code.

maybe you have some good suggestions of how to create layout templates in other ways?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 09-01-2008, 12:25 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default Re: Creating template system for my own cms

Quote:
Originally Posted by orjan View Post
Well, how would a template engine work otherwise, if not being a mid-layer in between the produced data and the finished html?

in this way, you can, with the same code, in an very easy way, make totally different layouts with the same data, even for two users at the same time.

maybe there are better template engines, That I can't tell, but I've found the smarty engine to work well for me, then I can create my coding, and then a designer can work with the tpl-files how they like without disturbing the code at all, just inserting variables (and a few control parameters) into their design-html-code.

maybe you have some good suggestions of how to create layout templates in other ways?
You have described is the exact reason behind the MVC structure. I believe a template should be a separate layer of abstraction almost completely decoupled from the MVC itself. That said, I place my "template" in then front controller. The front controller then loads the individual page controllers (and thus the associated models and views).

I have never used it, but phpSavant does not compile the template which makes a whole lot more sense to me.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 09-01-2008, 01:20 PM
orjan's Avatar   
orjan orjan is offline
Programming Professional
 
Join Date: Sep 2007
Location: Sunne, Värmland, Sweden
Age: 33
Posts: 328
Last Blog:
Procedural Programming...
Rep Power: 9
orjan has a spectacular aura aboutorjan has a spectacular aura aboutorjan has a spectacular aura about
Default Re: Creating template system for my own cms

Well, of course you have a point there about compiling. If I were new to using templates, your suggestion, phpSavant would probably be a better choice than Smarty, nor that I have used it either, so it would be up to each and everyone to choose.

I'm although very pleased with the Smarty system, and it works well for me. I don't think, that with todays better and better machines even in hosting, the execution time for doing compilages and stuff gets less relevant as the development goes, not saying that you do not would like a fast executable code because of this ...

What do all these large cms systems do to make different themes, as I don't think they are using either Smarty or phpSavant?

what is practical when building something like an cms and you want it to be easily redesigned?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
class prototype and template error hellochar C and C++ 7 07-17-2008 12:15 AM
DoublyLinkedList from hell nolsen01 C and C++ 2 05-13-2008 03:55 PM
using Template function Chinmoy C Tutorials 4 04-03-2008 05:16 AM
Anybody use SMARTY template system? Dan Website Design 7 07-27-2006 12:25 AM


All times are GMT -5. The time now is 07:08 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads