Ticket #610: jelix-trunk-#610.patch
| File jelix-trunk-#610.patch, 2.2 kB (added by bibo, 6 months ago) |
|---|
-
lib/jelix/core/response/jResponseHtmlFragment.class.php
old new 3 3 * @package jelix 4 4 * @subpackage core_response 5 5 * @author Tahina Ramaroson 6 * @contributor Sylvain de Vathaire 6 * @contributor Sylvain de Vathaire, Dominique Papin 7 7 * @copyright 2008 Tahina Ramaroson, Sylvain de Vathaire 8 * @copyright 2008 Dominique Papin 8 9 * @link http://www.jelix.org 9 10 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 10 11 */ … … 35 36 */ 36 37 public $tpl = null; 37 38 39 /**#@+ 40 * content surrounding template content 41 * @var array 42 */ 43 protected $_contentTop = array(); 44 protected $_contentBottom = array(); 45 /**#@-*/ 46 38 47 /** 39 48 * constructor; 40 49 * setup the template engine … … 58 67 59 68 if($this->hasErrors()) return false; 60 69 61 $content = '';70 $content = implode("\n",$this->_contentTop); 62 71 if($this->tplname!=''){ 63 $content =$this->tpl->fetch($this->tplname,'html');72 $content.=$this->tpl->fetch($this->tplname,'html'); 64 73 if($this->hasErrors()) return false; 65 74 } 75 $content .= implode("\n",$this->_contentBottom); 66 76 67 77 $this->_httpHeaders['Content-Type']='text/plain;charset='.$gJConfig->charset; 68 78 $this->_httpHeaders['Content-length']=strlen($content); … … 72 82 } 73 83 74 84 /** 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 /** 75 100 * The method you can overload in your inherited htmlfragment response 76 101 * after all actions 77 102 * @since 1.1
