Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,690 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,308 people online right now. Registration is fast and FREE... Join Now!




Php Templating system !?

 
Reply to this topicStart new topic

Php Templating system !?

nutter
post 6 Jun, 2008 - 01:28 AM
Post #1


New D.I.C Head

*
Joined: 3 Nov, 2007
Posts: 34


My Contributions


ok im working on a CMS im getting there but i have one big problem which is templating/themeing i have made my own templating system but it isnt practical

here it is:
CODE

include("templates/$theme/template.php"); // $theme varable gets the theme name from a database;

then the template file :
CODE

<?php
echo '<center>';
echo '<table width="674" height="661" border="0">';
echo '<tr>';
echo '<td height="140">';
echo $header;
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td height="23">';
echo $links;
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td id="maintext">';
echo $maintext;
echo '</td>';
echo '</tr>';
echo '</table>';
echo '</center>';
?>

$maintext displays the index text.
so that works ok untill i want to make a page say.. for contact which then the contact page ends up like the from page...
so does any one have any sujestions or tutorials of how i would make a templating system or expand on this one?
User is offlineProfile CardPM

Go to the top of the page

rjolitz
post 6 Jun, 2008 - 04:47 AM
Post #2


D.I.C Head

Group Icon
Joined: 17 May, 2008
Posts: 86



Thanked 1 times

Dream Kudos: 75
My Contributions


QUOTE(nutter @ 6 Jun, 2008 - 02:28 AM) *

ok im working on a CMS im getting there but i have one big problem which is templating/themeing i have made my own templating system but it isnt practical


I've been playing with Smarty after some discussion here. While I am far from an expert with it, I am finding it has some real advantages.

Instead of making one, you might look at how this might integrate into what you are doing and if it would work for you.

User is offlineProfile CardPM

Go to the top of the page

nutter
post 6 Jun, 2008 - 08:12 AM
Post #3


New D.I.C Head

*
Joined: 3 Nov, 2007
Posts: 34


My Contributions


QUOTE(rjolitz @ 6 Jun, 2008 - 05:47 AM) *

QUOTE(nutter @ 6 Jun, 2008 - 02:28 AM) *

ok im working on a CMS im getting there but i have one big problem which is templating/themeing i have made my own templating system but it isnt practical


I've been playing with Smarty after some discussion here. While I am far from an expert with it, I am finding it has some real advantages.

Instead of making one, you might look at how this might integrate into what you are doing and if it would work for you.

ok thanks would i need a webhost that has smarty installed?

User is offlineProfile CardPM

Go to the top of the page

rjolitz
post 6 Jun, 2008 - 09:38 AM
Post #4


D.I.C Head

Group Icon
Joined: 17 May, 2008
Posts: 86



Thanked 1 times

Dream Kudos: 75
My Contributions


QUOTE(nutter @ 6 Jun, 2008 - 09:12 AM) *

QUOTE(rjolitz @ 6 Jun, 2008 - 05:47 AM) *

QUOTE(nutter @ 6 Jun, 2008 - 02:28 AM) *

ok im working on a CMS im getting there but i have one big problem which is templating/themeing i have made my own templating system but it isnt practical


I've been playing with Smarty after some discussion here. While I am far from an expert with it, I am finding it has some real advantages.

Instead of making one, you might look at how this might integrate into what you are doing and if it would work for you.

ok thanks would i need a webhost that has smarty installed?


nope!

You can put the files in and just point to them.

This is the format you'd use except you'd need to substitute your own hosting info:

CODE

require('/usr/local/lib/php/Smarty/Smarty.class.php');
$smarty = new Smarty();

$smarty->template_dir = '/web/www.domain.com/smarty/templates';
$smarty->compile_dir = '/web/www.domain.com/smarty/templates_c';
$smarty->cache_dir = '/web/www.domain.com/smarty/cache';
$smarty->config_dir = '/web/www.domain.com/smarty/configs';


may need some minor tweaking and has a bit of a learning curve but doesn't appear anything really horrifying.

User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 07:39AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month