[eluser]rashgang[/eluser]
Hi All,
I didn't created any common template for every pages. i have admin panel. In the front-end i have pages like
Home, About us, career, etc............. for these menu i have created home controller seperatly and created about us controller seperately.
My About us controller code structure will be like this
Code:
public function index()
{
$data['title'] = 'About Us';
$data['news'] = $this->xxx_model->get_news();
$data['query'] = $this->xxx_model->get_clients_image();
$this->load->view('about_us',$data);
}
and in view page
Code:
<?php include('includes/header.php'); ?>
<div class="span4 blue">
<article>
<h2 class="sub-title"><span>Dedicated Service</span></h2>
<p>One of the ways we deliver on our commitment is through Dedicated Service. We achieve the same through understanding, Learning, timeliness, responsiveness and proactive approach.</p>
<p>We create a Win- Win Situation to all our clients.</p></article>
</div>
<?php include("includes/footer.php");?>
in footer.php i am passing the query results view
Code:
<?php //print_r($news);
foreach($news as $row){ ?>
<li><p><a href="<?php echo site_url('home/get_news_events/'.$row->id)?>">
<?php
if($row->category=="news"){
echo $row->news_title;
}else {
echo $row->news_title;
}
?></a><span class="date"> - <?php echo date('F d Y',strtotime($row->created_date)); ?></span></p></li>
<?php } ?>
My Problem is i have insert the every controller index page
Code:
$data['news'] = $this->xxx_model->get_news();
;
How to make this dynamic for every controller and make it common for every view. i dont want to pass the data in every controller. it should be one controller. Also Currently i have created many view pages like this.
Please help me.