【问题标题】:Call to undefined method Template::append_css()调用未定义的方法 Template::append_css()
【发布时间】:2013-08-15 20:20:56
【问题描述】:

我正在尝试使用下面的代码 append_css。在较旧的项目中,以下代码通常可以工作。作为参考,我正在使用 CodeIgniter 和模板 Sparks

    public function __construct() {
    parent::__construct();
    $this->load->library('template');
    $this->template
            ->append_css('/public/css/app.css');
  }
    public function index(){    
        $this->template->build('welcome_message.php');
    }
}

我收到以下错误

Fatal error: Call to undefined method Template::append_css() in /Users/Afont/quals/codeigniter-test/application/controllers/welcome.php on line 9

【问题讨论】:

  • 你得到什么错误?

标签: php codeigniter templates


【解决方案1】:

首先,在您的autoload.php 中,您可能想要自动加载火花:

$autoload['sparks'] = array('template/1.9.0');

第二,翻看代码,好像没有append_css函数。在PyroCMS 中,该库似乎具有该功能,但默认情况下没有火花。

【讨论】:

  • 啊,我明白了,谢谢。我习惯了 pyro 并认为它是可用的。
猜你喜欢
  • 2015-06-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-10
  • 2015-07-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多