Welcome Guest, Not a member yet? Register   Sign In
Problem loading external view
#1

[eluser]xzela[/eluser]
Hi all,

I'm having an issue loading a view from within a view. I continue to get a "An Error Was Encountered" error message when viewing any of the pages.
Here is the source code to the view I'm trying to use:
main_view.php
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;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
    &lt;link rel="icon" href="&lt;?php echo base_url();?&gt;favicon.ico" type="image/x-icon" /&gt;
    &lt;link rel="shortcut icon" href="&lt;?php echo base_url();?&gt;favicon.ico" type="image/x-icon" /&gt;    
    &lt;?php echo snappy_style('styles.css'); //autoloaded ?&gt;    
    &lt;title&gt;Mango - Main&lt;/title&gt;    
&lt;/head&gt;
&lt;body&gt;
&lt;?php
    $this->load->view('_global\header');
    $this->load->view('_global\menu');
?&gt;
<h1>Welcome to Mango</h1>
<p>Mango is Awesome</p>
&lt;?php
    $this->load->view('_global\footer');
?&gt;
&lt;/body&gt;
&lt;/html&gt;

header.php
Code:
&lt;?php
?&gt;
&lt;!-- START HEADER_VIEW --&gt;
<div id="header">
        <h1>Mango &copy; version 1.428</h1>
        <div style="float: right; height: 25px;">
            Welcome &lt;?php echo $user_data['user_name']; ?&gt; - &lt;?php echo $user_data['ip_address']; ?&gt;
        </div>        
</div>
&lt;!-- END HEADER_VIEW --&gt;
&lt;?php
/* End of file header_view.php */
/* Location: ./system/application/views/header_view.php */
?&gt;
When I load the view within the browser I get the "An Error Was Encountered" and the page stops rendering.

Quote:An Error Was Encountered
Unable to load the requested file: _global\header.php
If i comment out the external views, everything seems to be working. And if i just view the header view by itself, it renders properly. Am I loading these view incorrectly? Is there a better (best practices) way to this?

Let me know what you guys think.

Thanks


Messages In This Thread
Problem loading external view - by El Forum - 11-07-2008, 09:49 PM
Problem loading external view - by El Forum - 11-08-2008, 07:44 AM
Problem loading external view - by El Forum - 11-08-2008, 02:16 PM
Problem loading external view - by El Forum - 11-08-2008, 02:38 PM
Problem loading external view - by El Forum - 11-10-2008, 12:33 PM
Problem loading external view - by El Forum - 11-10-2008, 12:45 PM
Problem loading external view - by El Forum - 11-10-2008, 01:06 PM
Problem loading external view - by El Forum - 11-10-2008, 01:12 PM
Problem loading external view - by El Forum - 11-10-2008, 01:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB