Jag har gjort ett template system för detta.
Det består av en class som man initierar med en array med taggar som skall byta ut i en fil.
Documentation:
Template class
PHP Syntax:
$template = new Template('temp_name',
à array('PROP_NAME1'=>'PROP_VAL1','ARG_PROP2'=>'PROP_VAL2', ...));
$template->Top();
...
$template->Bottom();
- Uses template files (*.tpl). Searches in the ‘template_dir’ directory defined in prepend.php.
Template Syntax:
<!-- top_start -->, <!-- top_end -->, <!-- bottom_start -->,
<!-- bottom_end -->
- These labels divide the template into two parts, top and bottom.
[NAME:default value]
- Some of the values/properties can be set by adding a array with property values as seen above. The properties must be defined in the template. The default value is only used if the property isn’t defined in the array.
- Note that the [] – syntax can cause problems with js-code.
Example:
my_layout.tpl:
<!-- top_start -->
<html>
<head>
<title>[TITLE]</title>
<head>
<body bgcolor=”[BGCOLOR:#999999]”>
<!-- top_end -->
<!-- bottom_start -->
</body>
</html>
<!-- bottom_end -->
index.php:
require('prepend.php');
Import('Template');
$layout = new Template('my_layout',array('TITLE'=>'Bosma
à Development'));
$layout->Top();
print('hello world');
$layout->Bottom();
Returns this to the user:
<html>
<head>
<title>Bosma Development</title>
<head>
<body bgcolor=”#999999”>
Hello world.
</body>
</html>
Om du är intresserad kan jag skicka över: kontakta niels_bosma@hotmail.com
IDEE: Vore det inte bra om man kunde skicka upp filer tillsammans med sina forum postningar som man kan göra på http://vb-world.net?
------------------
www.phpfunctions.com