Pogledajte određenu poruku
Staro 21. 01. 2006.   #10
cvele
Banned
Knowledge base
 
Avatar cvele
 
Datum učlanjenja: 01.07.2005
Poruke: 1.598
Hvala: 206
140 "Hvala" u 89 poruka
cvele ima spektakularnu aurucvele ima spektakularnu auru
Default

Za tpl resenja ja koristim nesto mnooogo jednostavnije... doduse verovatno malo sporije resenje...

Evo klase:
PHP kôd:
<?php
class HtmlTemplate {

    var 
$template;
    var 
$html;
    var 
$parameters = array();

    function 
HtmlTemplate ($template)
    {
        
$this->template $template;
        
$this->html implode ("", (file($this->template)));
    }

    function 
SetParameter ($variable$value)
    {
        
$this->parameters[$variable] = $value;
    }

    function 
CreatePageEcho () 
    {

        foreach (
$this->parameters as $key => $value
        {
            
$template_name '{' $key '}';
            
$this->html str_replace ($template_name$value$this->html);
        }    
        echo 
$this->html;
    }
    function 
CreatePageReturn () 
    {

        foreach (
$this->parameters as $key => $value
        {
            
$template_name '{' $key '}';
            
$this->html str_replace ($template_name$value$this->html);
        }    
        return 
$this->html;
    }
}
?>
cvele je offline   Odgovorite uz citat