TVProjects top



TVProjects bottom
You are not registered.
Registration allows you to subscribe to projects, open projects, and more. Click here to register.

Website Source Code
<< Back

templates.php

<?php
    
function get_template($name$vars)
    {
        
$handle = @fopen('templates/' $name '.htm''r');
        
        if (
$handle)
        {
            
$contents '';
            while (!
feof($handle))
            {
                
$contents .= fgets($handle4096);
            }
            
fclose($handle);
            
            
$replace = array();
            
$with = array();
            foreach (
$vars as $key => $value)
            {
                
$replace[] = '/&/'.$key.'/&/';
                
$with[] = $value;
            }
            
$contents str_replace($replace$with$contents);
            
            return 
$contents;
        }
        else
        {
            die(
'Error! (template opening)');
        }
    }
?>