0
我使用CodeIgniter Template和CodeIgniter PHP框架。我不知道這個庫中的元數據是如何工作的(模板)。我嘗試添加style.css到我的佈局。在用戶手冊,我發現信息:CodeIgniter中的Style.css PHP和模板庫
**prepend_metadata()**
Add a line to the start of the $template['metadata'] string.
Parameters
$line - string REQUIRED - Metadata line.
Usage
$this->template->prepend_metadata('<script src="/js/jquery.js"></script>');
在我的佈局文件,我有:
<head>
<title>TITLE</title>
<?=$template['metadata']?>
</head>
在Controller文件:
$this->template
->prepend_metadata('<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />')
->set_layout('index');
這看起來不錯,但不一切工作。
Style.css位於views/css/style.css中,佈局文件(index.php)位於views/css/layout/index.php中。
感謝您的幫助!
嘗試使用HREF = '<= BASE_URL()?> CSS/style.css中' – Sudarshan 2014-09-01 14:42:57
'BASE_URL()'+''/目錄/路徑/到/ css''或'BASE_URL ('directory/path/to/css')' – tomexsans 2014-09-01 17:48:43
I tired base_url(「appli陽離子/ views/css/style.css「)或者base_url()?> css/style.css和nothing; / – 2014-09-01 21:03:35