Welcome Guest, Not a member yet? Register   Sign In
Dynamical content loading question
#8

[eluser]xwero[/eluser]
For your first question you can load it in the controller. For example load a partial page in the header.
Code:
// views/header.php
<h1>My site</h1>
&lt;?php echo $subheader ?&gt;
// controller
function some_action()
{
   $this->load->vars(array('subheader'=>$this->load->view('subheader','',TRUE));
}
The default view files can be overwritten at any time with the same method i used above.

For your second problem you can create a controller named static with a html method. Route all the static pages to that controller and method and change the post_controller function to
Code:
function post_controller()
{
   $CI =& get_instance();
   if($CI->uri->rsegment(1) != 'static' && $CI->uri->rsegment(2) != 'html')
   {
       $CI->load->view('pageparts/template');
   }
}
The beauty of not having a lot of code to deal with is that it's easy to change it to whatever you need. It is a raw way of dealing with templates but if you go for a library it will not be so easy to change it, if the developer didn't think of it.


Messages In This Thread
Dynamical content loading question - by El Forum - 01-06-2009, 09:27 AM
Dynamical content loading question - by El Forum - 01-06-2009, 09:41 AM
Dynamical content loading question - by El Forum - 01-06-2009, 10:05 AM
Dynamical content loading question - by El Forum - 01-06-2009, 11:05 AM
Dynamical content loading question - by El Forum - 01-06-2009, 12:15 PM
Dynamical content loading question - by El Forum - 01-06-2009, 01:17 PM
Dynamical content loading question - by El Forum - 01-06-2009, 01:44 PM
Dynamical content loading question - by El Forum - 01-06-2009, 04:30 PM
Dynamical content loading question - by El Forum - 01-06-2009, 05:19 PM



Theme © iAndrew 2016 - Forum software by © MyBB