Welcome Guest, Not a member yet? Register   Sign In
View inside a view?
#1

[eluser]skunkbad[/eluser]
I've got two areas in my template (which is a view), that are filled in with smaller snippets of html (which are also views), but the output of the page has the snippets above the template code.

This is my first attempt at CodeIgniter, and I'm converting my home page over from Kohana, which easily allows views to be inside views. Perhaps I'm not doing it right, but is this possible with CodeIgniter?

Code:
$pageStyle = 'some_data_string';
$colB = array ( $pageStyle );
$data = array(
    'colA' => $this->load->view('home/colA_content' ),
    'colB' => $this->load->view('home/colB_content', $colB ),
);
$this->load->view('template_content', $data );

Output should be colA and colB inside the template, but right now the output is:

colA
colB
template
#2

[eluser]wiredesignz[/eluser]
You should read the user guide views section regarding returning views to variables. http:///user_guide/general/views.html
#3

[eluser]skunkbad[/eluser]
OK, I see where a view can be returned as data by setting the third parameter to true. After working in one framework, it takes some adjustment to change the way my brain has been thinking things should work.

Thank you.




Theme © iAndrew 2016 - Forum software by © MyBB