Hi, CodeIgniter users!
As you can se, I’m new in this community and afterall quite new in frameworks. I found CI very usefull and easy to use but still I ran into one problem. So here is the deal.
I’m developing a website about computer graphics and web design, so I created controllers for each menu section (news, articles, usefull links, contact form, users list). By default CI loads news controller when someone enters the website. Now, I’ve splitted main view file into seperate files and this is how it looks like:
<!-- <WRAPPER -->
<div id="wrapper">
<?php $this->load->view('header');
$this->load->view('menu');
?>
<div id="content">
<?=$this->load->view(CONF_PAGE)?>
</div>
<?php $this->load->view('additional'); ?>
<div id="clear"></div>
<!-- </WRAPPER -->
</div>
<?php $this->load->view('footer'); ?>
</body>
</html>
<?=$this->load->view(CONF_PAGE)?>
This loads view file depending on what controller is active at the momment.
<?=$this->load->view('additional')?>
This one loads whatever the controller is. So the problem is I added a mysql query into news controller to get the data from DB and show it in every page. But I forgot that it won’t work if, for example, the articles controller will be active at the moment. The main question would be, where and how to add mysql query so data would be shown?
Sorry if my question is not perfectly clean for you, I just don’t know how to explain it in other words. I’d be grateful for your help. ![]()
Live example of this problem can be seen here: http://www.e-grafika.lt/ci/ after the text “MĖNESIO SVETAINĖ”.
