Building a Site Engine with PHP, Part 4 - The Final Words
(Page 4 of 4 )
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.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
|
| · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | | |
|