Location: PHPKode > scripts > Pine template > pine-template/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
{
// public methods
    public function display($a, $wh, $clr=true, $ld=true)
    {
    if($ld) { $where=tpl::load($wh); }
    else { $where=$wh; }
        $ret=$where;
        if(is_array($a))
        {
            foreach($a as $k => $v)
            {
                $ret=tpl::change($k, $v, $ret);
            }
        }
        if($clr)
        {
        return tpl::clear($ret);
        }
        else
        {
        return $ret;
        }
    }
// private methods
    protected function load($fn)
    {
    $ret="";
        if(file_exists($fn))
        {
            $ret = file_get_contents($fn);
        }
        else
        {
            $ret = "";
        }
        return $ret;
    }
    public function change($what, $whit, $where)
    {
        if(!empty($where))
        {
            $ret=ereg_replace("{".strtoupper($what)."}", trim($whit), $where);
        }
        return $ret;
    }
    protected function clear($c)
    {
    $temp = ereg_replace("{([A-Z0-9_]+)}","",$c);
    return $temp;
    }
}
?>
Return current item: Pine template