Hi everyone thank you for taking time to look at my question.
I have tried to run view (site_nav, site_header and site_footer) together only and it worked fine.
When I tried to run view (view_home) and the models it also worked fine.
However when I run all the views and models together, the view (site_nav, site_header and site_footer) does not work.
Could anyone please help?
public function home(){
$this->load->model("model_cms_home");
$data["results"] = $this->model_cms_home->getData("cms_home");
$this->load->view("site_nav");
$this->load->view("site_header");
$this->load->view("view_home", $data);
$this->load->view("site_footer");
}
VIEW("view_home")
<div id="home_hat1"> <img src="<?php echo base_url(); ?>pics/home_hat1.jpg"> </div>
<div id="content">
<div id="dinner">
<div class="home_title">
<?php
$query = $this->db->query("SELECT `title` , `text1` FROM `cms_home` WHERE `ID` =1");
if ($query->num_rows() > 0){
$row = $query->row_array();
echo $row['title'];
}
?>
</div>
<div class="home_content">
<?php
$query = $this->db->query("SELECT `title` , `text1` FROM `cms_home` WHERE `ID` =1");
if ($query->num_rows() > 0){
$row = $query->row_array();
echo $row['text1'];
}
?>
</div>
</div>
You cannot call multiple view in one controller function. This can be done into view. I suggest you that you should first create a templete and in that template call your views like this
templete.php
<html>
<head>
<body>
$this->load->view("site_nav");
$this->load->view("site_header");
<?php echo $content; ?>
$this->load->view("site_footer");
</body>
</head>
</html>
MY suggestion is to call other page in view_home using include();. You cant see other pages as the last page will be called according to your code. If you put an alert in each page you will know it has actually called all the pages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With