Welcome Guest, Not a member yet? Register   Sign In
Template file + Matchbox
#1

[eluser]eokorie[/eluser]
At the moment, I currently have my views setup with with the header and footer with the content in between.

i.e.
Code:
<?php $this->load->view('templates/golf/includes/header'); ?>

<h1>My Page</h1>

&lt;?php
$this->load->view('templates/golf/includes/sidebar');
$this->load->view('templates/golf/includes/footer');
?&gt;

All I then simply do is call the view file in the Controller and its working ok.

But I am trying to move on from this level of doing things. I have tired the method where everything is setup in a template file as show below:

Code:
&lt;?php
$this->load->view('templates/golf/includes/header');
$this->load->view($body_content);
$this->load->view('templates/golf/includes/sidebar');
$this->load->view('templates/golf/includes/footer');
?&gt;

Then in the controller, I add the code to load up the view to body_content.

Code:
$data['body_content'] = $this->load->view('main_index', '', true);  
$this->load->view('templates/golf/template', $data);

Unfortunately everytime I try to use this method with Matchbox, although it loaded the view in question, it does not complete and still reports that its not able to find the requested file and just displays .php as the file name.

Does anyone know what I can do to remedy this problem? Thanks
#2

[eluser]theprodigy[/eluser]
Quote:$data['body_content'] = $this->load->view('main_index', '', true);
This line of code is parsing the view. Your $data['body_content'] variable now holds the html content that you need.

If you changed
Code:
$this->load->view($body_content);
to
Code:
echo $body_content

it should work just fine




Theme © iAndrew 2016 - Forum software by © MyBB