查看Codeigniter css

6kkfgxo0  于 8个月前  发布在  其他
关注(0)|答案(1)|浏览(49)

我添加了一个新的函数,叫做“css_url”。我设置在控制器的构造函数,它的作品.另外,我想在视野中找到目标。在视图目录我把主题,每个主题都有自己的资产。如何访问视图目录中的资产?

-view
--theme1
---assets
----css
----js
----images
-----f1.jpg



public function __construct() {
    parent::__construct();
    // Temel veriler veri tabanından çekilecek;
    $this -> theme = "theme1";

    $this->config->set_item('css_url', $this->theme);
}

css_url(“images/f1.jpg”);

zzwlnbp8

zzwlnbp81#

后藤application/config/autoload.php and url helper like this.

$autoload['helper'] = array('url');

现在你可以使用base_url()函数在视图中访问assets文件夹了,如下所示...

<?php echo base_url('assets/css/yourstyle.css'); ?>

将assets文件夹放在应用程序的根目录下.

application/
assets/
system/

相关问题