Ticket #610: jelix-trunk-#610.patch

File jelix-trunk-#610.patch, 2.2 kB (added by bibo, 6 months ago)

patch

  • lib/jelix/core/response/jResponseHtmlFragment.class.php

    old new  
    33* @package     jelix 
    44* @subpackage  core_response 
    55* @author      Tahina Ramaroson 
    6 * @contributor Sylvain de Vathaire 
     6* @contributor Sylvain de Vathaire, Dominique Papin 
    77* @copyright   2008 Tahina Ramaroson, Sylvain de Vathaire 
     8* @copyright   2008 Dominique Papin 
    89* @link        http://www.jelix.org 
    910* @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
    1011*/ 
     
    3536    */ 
    3637    public $tpl = null; 
    3738 
     39    /**#@+ 
     40     * content surrounding template content 
     41     * @var array 
     42     */ 
     43    protected $_contentTop = array(); 
     44    protected $_contentBottom = array(); 
     45    /**#@-*/ 
     46 
    3847    /** 
    3948    * constructor; 
    4049    * setup the template engine 
     
    5867 
    5968        if($this->hasErrors()) return false; 
    6069 
    61         $content = ''
     70        $content = implode("\n",$this->_contentTop)
    6271        if($this->tplname!=''){ 
    63             $content=$this->tpl->fetch($this->tplname,'html'); 
     72            $content.=$this->tpl->fetch($this->tplname,'html'); 
    6473            if($this->hasErrors()) return false; 
    6574        } 
     75        $content .= implode("\n",$this->_contentBottom); 
    6676 
    6777        $this->_httpHeaders['Content-Type']='text/plain;charset='.$gJConfig->charset; 
    6878        $this->_httpHeaders['Content-length']=strlen($content); 
     
    7282    } 
    7383 
    7484    /** 
     85     * add content to the response 
     86     * you can add additionnal content, before or after the content generated by the main template 
     87     * @param string $content additionnal html content 
     88     * @param boolean $beforeTpl true if you want to add it before the template content, else false for after 
     89     */ 
     90    function addContent($content, $beforeTpl = false){ 
     91      if($beforeTpl){ 
     92        $this->_contentTop[]=$content; 
     93      }else{ 
     94         $this->_contentBottom[]=$content; 
     95      } 
     96    } 
     97 
     98 
     99    /** 
    75100     * The method you can overload in your inherited htmlfragment response 
    76101     * after all actions 
    77102     * @since 1.1 
Download in other formats: Original Format