Welcome Guest, Not a member yet? Register   Sign In
Hey there! Welcoming myself to CI, with a twist.
#3

[eluser]skunkbad[/eluser]
Hi Pico,

Welcome. I've never seen any templates that designed for CI, and I think the reason is that making a template for CI would assume that everyone codes the same way. Some people, like you, are using header and footer files, but I don't use them. Instead I have a complete template, and I have nested views for columns A, B, C, etc. The beauty of CI is that any existing template can be used to insert dynamic data into, but I guess your problem would be that you don't understand how to get it there, and how to set up the template to accept the data coming from the controller.

Basically, somewhere in your controller, you will load a view:

Code:
$this->load->view('home','',FALSE);

This would simply load a view. Notice that the second parameter is blank, which means that no data is being sent to the view from the controller. If you wanted to send some data, you would create an array, and then send the array in that second parameter:

Code:
$arr = array('skunkbad'=>'boogaloo');
$this->load->view('home',$arr,FALSE);

So now that you have sent some data to the view, you use it in the view by simply doing something like this:

Code:
<p>&lt;?php echo $skunkbad; ?&gt;</p>

Now we can move on to bigger and better things. Let's suppose that you want a view withing a view. First, you create a view to insert, tell it not to output instantly by setting the third parameter to TRUE, and well, just see:

Code:
$arr['inner_view'] = $this->load->view('menu','',TRUE);
$this->load->view('home',$arr,FALSE);

Now, inside the view, we can insert the 'menu' whereever we want by doing this:

Code:
<ul>
   &lt;?php echo $inner_view ?&gt;
</ul>

So, as you can see, working with CI is about as easy as anything. Post some code, and/or give us a link to check out your site, and we might be able to better help you out.

Enjoy!


Messages In This Thread
Hey there! Welcoming myself to CI, with a twist. - by El Forum - 08-22-2009, 08:45 PM
Hey there! Welcoming myself to CI, with a twist. - by El Forum - 08-22-2009, 11:59 PM
Hey there! Welcoming myself to CI, with a twist. - by El Forum - 08-23-2009, 12:08 AM
Hey there! Welcoming myself to CI, with a twist. - by El Forum - 08-23-2009, 01:27 AM
Hey there! Welcoming myself to CI, with a twist. - by El Forum - 08-23-2009, 03:51 AM
Hey there! Welcoming myself to CI, with a twist. - by El Forum - 08-23-2009, 08:05 AM
Hey there! Welcoming myself to CI, with a twist. - by El Forum - 08-23-2009, 12:58 PM
Hey there! Welcoming myself to CI, with a twist. - by El Forum - 08-25-2009, 02:22 PM
Hey there! Welcoming myself to CI, with a twist. - by El Forum - 08-25-2009, 11:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB