[請益] CI裡面header檔案的寫法 codeigniter
我把 header 檔獨立出來成一個view
比如說在 index的view裡面
我會先load $this->load->view('header',$data);
但是因為這個header檔案我有點把它當 common fuction在用。
每個view都會去load 這個 header檔
但是每個view 可能需要額外 load js/css 之類的檔案還會有所差異
所以我作法如下
在 index view 裡面
<?
$this->load->view('header',$data, TRUE);
//下面擺上我在個別頁面所需要的檔案
<script type="text/javascript" src="assets/js/order_tip.js">
~~~~
?>
</head> //最後用</head> 結束 這個head block
但是這樣卻不work , 我用firebug看。
HTML下面 <head> </head> 是空的
Script tab 裡面也是一大堆 js 檔案根本就沒有load進來。
我的 header view 結構如下
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"" rel="nofollow">http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="" rel="nofollow">http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8, IE=9, IE=10" >
~~~~~~
不會有結尾的 </head>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 119.77.136.156
推
08/28 09:13, , 1F
08/28 09:13, 1F
→
08/28 09:13, , 2F
08/28 09:13, 2F
推
08/28 12:02, , 3F
08/28 12:02, 3F
→
08/28 18:23, , 4F
08/28 18:23, 4F
→
08/28 18:24, , 5F
08/28 18:24, 5F
→
08/28 18:24, , 6F
08/28 18:24, 6F
→
08/28 19:54, , 7F
08/28 19:54, 7F
→
08/28 19:54, , 8F
08/28 19:54, 8F
→
08/28 19:55, , 9F
08/28 19:55, 9F
→
08/28 19:55, , 10F
08/28 19:55, 10F
→
08/29 02:27, , 11F
08/29 02:27, 11F
→
08/29 02:27, , 12F
08/29 02:27, 12F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 3 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章