Location: PHPKode > projects > Pine template > pine_template-2008-01-12/template.lib.php
<?php
/*
Created by Andras Zoltan-Gyarfas from Transilvania in 2007
email: hide@address.com
Use this script as you wish, just please send a notice for me if you do so.
For more questions/suggestions, please contact me.
*/

class tpl
{
// class vars
var $c=null;

//construct method
    function tpl() { }

// public methods

    function display($c)
    {
    return $this->clear($c);
    }

    function load($fn)
    {
        if(file_exists($fn))
        {
            $this->c = file_get_contents($fn);
        }
        else
        {
            $this->c = $fn;
        }
    }

    function change_array($a)
    {
        if(is_array($a))
        {
            foreach($a as $k => $v)
            {
                $this->change($k, $v);
            }
        }
    }

    function get_c()
    {
        return $this->c;
    }


// private methods

    function change($what, $whit)
    {
        if(!empty($this->c))
        {
            $this->c=ereg_replace("{".strtoupper($what)."}", trim($whit), $this->c);
        }
    }

    function clear($c)
    {
    $temp = ereg_replace("{([A-Z0-9_]+)}","",$c);
    return $temp;
    }
}
?>
Return current item: Pine template