我有一个带有 jquery 选项卡的标题(视图),它将成为我项目的“模板”。但是,我的标题和内容总是显示两次。这是屏幕截图(取自您在下面看到的控制器):
这是我的标题的观点:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Johanes Indra</title>
<link rel="stylesheet" href="<?php echo base_url(); ?>jquery/jquery-ui-1.10.2.custom/css/ui-lightness/jquery-ui-1.10.2.custom.min.css" />
<script language="javascript" type="text/javascript" src="<?php echo base_url(); ?>jquery/jquery-ui-1.10.2.custom/js/jquery-1.9.1.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo base_url(); ?>jquery/jquery-ui-1.10.2.custom/js/jquery-ui-1.10.2.custom.min.js"></script>
<script type="text/javascript" language="javascript">
$(function() {
$( "#tabs" ).tabs();
});
</script>
<div id="header"><h1>HEADER</h1></div>
<div id="tabs">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Gallery</a></li>
<li><a href="#">About Me</a></li>
<li><a href="#">All About Love</a></li>
</ul>
</div>
</head>
这是内容的视图(在标题下方):
<body>
<div id="content">
<?php echo $content; ?>
</div>
这是加载标题和内容的控制器:
class Home extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('content_m');
}
public function index() {
$get_content = $this->content_m->get_content('mscontent');
foreach($get_content as $temp)
$data['content'] = $temp->content;
$this->load->view('header_v');
$this->load->view('home_v', $data);
}
我的错误在哪里?感谢:D
编辑 :
这是我查看页面源代码时生成的代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Johanes Indra</title>
<link rel="stylesheet" href="http://localhost/ci_buku_indra/jquery/jquery-ui-1.10.2.custom/css/ui-lightness/jquery-ui-1.10.2.custom.min.css" />
<script language="javascript" type="text/javascript" src="http://localhost/ci_buku_indra/jquery/jquery-ui-1.10.2.custom/js/jquery-1.9.1.js"></script>
<script language="javascript" type="text/javascript" src="http://localhost/ci_buku_indra/jquery/jquery-ui-1.10.2.custom/js/jquery-ui-1.10.2.custom.min.js"></script>
<script type="text/javascript" language="javascript">
$(function() {
$( "#tabs" ).tabs();
});
</script>
<div id="header"><h1>HEADER</h1></div>
<div id="tabs">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Gallery</a></li>
<li><a href="#">About Me</a></li>
<li><a href="#">All About Love</a></li>
</ul>
</div>
</head>
<body>
<div id="content">
content dari DB </div>
</body>
</html>