Dynadot

Help with template systems

Spaceship Spaceship
Watch
Hello everyone,

I've been researching template systems and found this site on google. I myself just got accustomed to linear programming style and have made a working cms using the include(''); method for template systems.

I have read 4 articles on this site and the ones @ codewalkers without much success. I can understand about 70% of the code and what it does but when it comes to displaying content from say the main "index" page to say the "about me" page I am getting confused.

BTW here are the articles I found:
http://namepros.com/code/443220-output-class-php5.html
http://namepros.com/code/307704-php-template-system-class.html
http://namepros.com/code/189417-php-template-system-php4-5-a.html
http://www.namepros.com/code/120978-php-template-script.html

Most of these examples use something like (taken from BillyConnite's example):
PHP:
  <?php

require_once('template.class.php');

$tpl = new Page('design.html');
$tpl->replace_tags(array(
    'title' => 'This is the title of my html page',
    'content' => 'Here\'s some content which I am putting inside the page, yaaay.'
));
$tpl->output();

?>

This uses 'content' =>'string' as the way to display the content... butwhat i don't understand is how would you split it up to link individual pages?

For instance:

I have a pre-made template with a header, left navbar, main content, and a footer. A basic CSS template. What I am wanting to do using this template system is have the template file as follows:
Code:
<html>
<head>
<title></title>
</head>
<body>

where the leftnavbar.php file, and the maincontent.php file would later be included but is empty because this is just the default template.

</body>
</html>

Then call the leftnavbar.php file, and the maincontent.php file as individual pages...

If i could figure that out I would have half of my problem resolved. The other half being how when the user clicks a link, goes to it and the template loads with the correct maincontent file...

If anyone could help me clear this up or direct me to somewhere that the whole process is explained. I would be really grateful!!!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
I would recommend checking out Swift Engine. Its very simple and easy to use and best of all its free.

http://swiftengine.com/

Trust me, its lightweight and the code is extremely easy to understand. Better yet its also an Internationalization engine all rolled into one (for supporting different languages in your templates automatically).

Regards,

Dave
 
0
•••
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back