【问题标题】:template library codeigniter模板库代码点火器
【发布时间】:2012-10-10 07:21:23
【问题描述】:

我使用codeigniter的模板库设计了一个模板,模板有以下区域:

$template['template_ar']['template'] = 'template_ar';
$template['template_ar']['regions'] = array(
  'header',
  'title',
  'content',
  'topcontent',
  'sidebar',
  'footer',
  'options',
  'script',
);

我使用下面的代码来渲染我的模板

class faq extends MY_Controller {
  /** 
  * Index
  * This function views the Home Page
  * 
  * @access  public
  * @return  
  */

  public function index() {
    $this->template->write_view('content','comment/questions');   
    $this->template->write('options','You one',TRUE);      
    $this->template->render();
  }
}

我想消除的问题是我想阻止热门内容出现在我的模板中。我只需要内容、页眉和页脚。谁能告诉我怎么做?

【问题讨论】:

标签: php codeigniter templates


【解决方案1】:

Template Library for CodeIgniter

设置写入区域

$this->template->set_regions($regions);

将区域动态添加到当前设置的模板中

$this->template->add_regions($name, $props);

清空区域内容

$this->template->empty_region($name);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-09
    • 2011-06-04
    • 2016-01-28
    • 2012-06-30
    • 2012-02-21
    • 2011-03-29
    相关资源
    最近更新 更多