10-24-2007, 07:44 PM
|
#21 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Well, I can't give you any other example than the template engine that vBulletin has, it's awesome.
And I know I can use smarty or savant.
But I want to code it myself, and be able to feel that I've done the template engine myself(with your help), other than using a free script.
Quote:
Originally Posted by Karl
I actually wrote a class to do this exact same thing yesteday. Essentially though, it's simply a template within a template. The outter template provides the layout, such as:
PHP Code:
<html>
<head>
<title>$pageTitle</title>
</head>
<body>
$pageContent
</body>
</html>
You then render your inner template (I call them Views - from an MVC pattern), store it in a string and push it to the layout as $pageContent. I will wrire up a tutorial for a simplified version of this soon, however it wont be for a few days as I am currently busy with other things :(
|
Do you run this with if statements aswell?
PHP Code:
<html>
<head>
<title>$title</title>
</head>
<body>
<if condition="$logged">
Welcome $userinfo[name]!
Your last visit was: $userinfo[lastvisit].
</if>
<else>
Welcome guest! Please login or register.
</else>
</body>
</html>
Like that! That would be awesome ;)
Anyways, are you going to write that tutorial anyways? :)
|
|
|
|