HomePHP Page 4 - Building a Site Engine with PHP, Part 4
The Final Words - PHP
In the last three articles we went over a basic idea of how a site engine works, how to build the plug-in, module, and block systems, the basic directory structure, the database structure, and the authentication methods. In this, the fourth article, we’ll be going over the template system, and the basic page loading methods. So, let’s go ahead and get started.
It’s not hard to create your own tags; all you have to do is send them to the array of tags. Here’s a small example, if you wanted tags that will show the date and time -- all you’d have to do is put in the following code, after you’ve declared the template class.
$template->tags['date']=date("l F, j Y");
$template->tags['time']=date("g:i:sa");
Then anywhere you have the tag that looks like <!date>, it will show the date like this: Thursday June, 10 2004, and the <!time> tag will show the time like this: 2:17:04pm. On top of that a tag can show anything -- a tag can be an include, a string, even an image. For example, if you do this $template->tags['test']="foo"; the tag <!test> will show the word “Foo”. It’s pretty cool if you ask me.
To add columns to your layout, all you have to do is add them to the template file named column4, column5 and so on.
Well that’s about it for this article. In the fifth and final article I’ll show you what you need to do to add plug-ins , modules, and blocks to the engine.