Jump to content
php.lv forumi

Ilja

Reģistrētie lietotāji
  • Posts

    2
  • Joined

  • Last visited

Posts posted by Ilja

  1. Sheit,izdariju mazu skriptinu...bet man vinsh ir palidzigs :)

    negribu kaut kadu Smarty vai t.c. izmantot...

    es esmu slinks-tapec loti maz un vienkarshi :D

    bet kaut ko vel uzrakstishu...

    PS ka varu-ta rakstu...kadi kommentari?

    ceru kaut kadam noderes,varbut citi ari palidzes kaut ko vel uzrakstit xD

     

    class Template{
    
    var $template;
    var $fp;
    var $tags;
    var $datas;
    
    function Load($filename="./templates/index.html"){
    
    	$this->fp=fopen($filename,"r");
    	if ( !$this->fp ) echo "Cannot open Template:".$filename;
    	$this->template=fread($this->fp,filesize($filename));
    
    	}
    
    function AddTag($tag,$data){
    
    	$this->tags[]=$tag;
    	$this->datas[]=$data;
    
    	}
    
    function Process(){
    
    	$this->template=str_replace($this->tags,$this->datas,$this->template);
    
    	}
    
    function Render(){
    
    	return $this->template;
    
    	}
    
    }

×
×
  • Create New...