zqge 发表于 2013-12-25 22:21:20

CI view中怎样包含头部页面

新手初学做一个页面,因为头部页面是一样的所以想别的页面都包含它而不用再写。。
   
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><head><title></title>
<link href="CSS/style.css" rel="stylesheet">
</head>
<table width="900" height="598" align="center" bordercolor="#CCCCCC">
<tr>
    <td height="89" colspan="3"><strong>
      <?php include("top.php")?>
</strong></td>
</tr>



代码如上,PHP中是这样包含的,但是在CI中不知道怎么做,不想用frame的方法,还有别的办法吗,大神们求救~!

loadinger 发表于 2013-12-26 09:40:07

还是写一下吧。感觉好点。呵呵。或者改改load view 先读header文件?

End____落幕 发表于 2013-12-26 11:57:40

<?php view('header');?>

ljc 发表于 2013-12-27 16:43:32

<?=$this->load->view('header');?>

Dis_y 发表于 2016-2-17 11:09:24

ljc 发表于 2013-12-27 16:43


这个是在控制器中写,还是在视图中写?

ljc 发表于 2016-3-29 14:53:09

Dis_y 发表于 2016-2-17 11:09
这个是在控制器中写,还是在视图中写?

视图中

jone 发表于 2016-3-30 09:10:20

不要include,写成<?php $this->load->view('top');?>

Aloghli 发表于 2016-3-30 10:09:46

CI中不能这样使用的只是一个框架哦$this->load->view('top')
页: [1]
查看完整版本: CI view中怎样包含头部页面