It shows that you are unregistered. Please register with us by clicking Here
![]() |
|
![]() |
![]() | Register - FAQ - Today's Posts - New Posts - Support - Search | ![]() |
![]() |
![]() |
|
LinkBack | Thread Tools | Display Modes | ![]() |
|
|
#1 (permalink) |
|
Junior Member
Join Date: Jul 2006
Age: 19
Posts: 11
|
I wrote this for personal use when I needed a simple template system for a blog script.
Code:
<?php
function mk_temp($template,$str_replace)
{
$temp = file_get_contents($template.'.tpl');
foreach ($str_replace as $tag => $replacewith) {
$temp = str_replace('<'.$tag.'>',$replacewith,$temp);
}
echo $temp;
}
?>
PHP: Code:
<?php
include 'tplsys.php';
echo mk_temp('hello',array('what' => 'World'));
?>
Code:
Hello <what>! Code:
Hello World!
__________________
~ Christopher Clarke E-mail : gamelab2k@gmail.com |
|
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Share you wap scripts here | abhisar | Programming | 6 | 10-12-2006 01:08 AM |
| [PHP5] A review system class | Seph | PHP | 7 | 07-26-2006 08:39 AM |
| Can you give an example of what might be best suited to place the Application_Start | agaba175 | .NET | 0 | 07-26-2006 05:45 AM |
| [PHP5] A SQL class | Seph | PHP | 1 | 07-24-2006 07:21 PM |
| Code Snippet: A Simple Templating Class | Jamie | PHP | 2 | 07-23-2006 12:01 AM |