Welcome Guest, Not a member yet? Register   Sign In
Loading multiple views doesn't work
#1

[eluser]CoderReborn[/eluser]
In my main controller I end with:

Code:
...
/* Load HTML */
           $this->load->view('header_view');
           $this->load->view('contents_view', $data);
           $this->load->view('footer_view');

The "header_view" file includes the html headers (including my CSS and JS files).
The "contents_view" and "footer_view" files do not include the <header> element.

I can get the first two views to load, but loading "footer_view" results in the following error:

Quote:An Error Was Encountered

Unable to load the requested file: footer_view.php


Here's the code for the footer:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;

    &lt;body&gt;
        <div id="footer">
            <div class="footer-holder">
                &lt;!-- navigation --&gt;
                <ul class="bottom-nav">
                    <li><a href="#">About Us</a></li>
                    <li><a href="#">Terms of Service</a></li>
                    <li><a href="#">Privacy Policy</a></li>
                    <li><a href="#">Contact Us</a></li>
                </ul>
                <p>Copyright &copy; 2010 My Company Inc., All Rights Reserved</p>
            </div>
        </div>
    &lt;/body&gt;
&lt;/html&gt;


I've seen Chuck Son's post on the wiki http://codeigniter.com/wiki/Chuck_Son's_take/ , but there are some controllers where I don't want the footer to be displayed afterwards (e.g. in controllers that process forms).

Thanks for your help!
#2

[eluser]pam81[/eluser]
Hi, iuse to load multiple views like you describe but I don't include de doctype or body because at the end you are trying to create a page with three views so

HEADER
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt; &lt;!-- see it close on the footer--&gt;
&lt;head&gt;
&lt;title&gt; &lt;/title&gt;
...
&lt;/head&gt;

CONTENT
&lt;body&gt; &lt;!-- see it close on the footer--&gt;
<div id="content">
</div>

FOOTER
<div id="footer">
<div class="footer-holder">
&lt;!-- navigation --&gt;
<ul class="bottom-nav">
<li><a href="#">About Us</a></li>
<li><a href="#">Terms of Service</a></li>
<li><a href="#">Privacy Policy</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
<p>Copyright &copy; 2010 My Company Inc., All Rights Reserved</p>
</div>
</div>
&lt;/body&gt;
&lt;/html&gt;
#3

[eluser]CoderReborn[/eluser]
To clarify, the "header_view" file includes html headers AND the main navigation elements in the &lt;body&gt;.

So, how would this be done since "header_view" and "contents_view" body contain elements inside &lt;body&gt;?

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB