Welcome Guest, Not a member yet? Register   Sign In
Strange characters output when combining views segments
#1

[eluser]got 2 doodle[/eluser]
Hi I am working on my first CI app. I have broken an html page down into segments and I am re-assembling them with CI but I am getting a few strange characters output between two of the views. Here is a 'view->source' dump from the browser.
Code:
<div id="RsSpacer2"></div>
</div>

<div id="MainText">
  <p><h1>Welcome!</h1></p>
  <p>Welcome to the
Notice the strange characters before the "MainText" div.

Here is the relevant part of the controller
Code:
/* Load views  */
        
        $output = $this->load->view('view_header',$data,true);
        $output .= $this->load->view('view_nav',$data,true);
        $output .= $this->load->view("$page_name/rs_content",$data,true);
        $output .= $this->load->view("$page_name/view_content",$data,true);
        $output .= $this->load->view("$page_name/ls_content",$data,true);
        $output .= $this->load->view('view_footer',$data,true);
        $this->output->set_output($output);
    }
The strange characters come between "rs_content" and "view_content"

If I rem all other views:

Code:
/* Load views  */
        
     /* $output = $this->load->view('view_header',$data,true);
        $output .= $this->load->view('view_nav',$data,true);
        $output .= $this->load->view("$page_name/rs_content",$data,true);
     */

        $output .= $this->load->view("$page_name/view_content",$data,true);

     /* $output .= $this->load->view("$page_name/ls_content",$data,true);
        $output .= $this->load->view('view_footer',$data,true);
     */
        $this->output->set_output($output);
    }
so now I am only loading the "view_content" view
I get
Code:
<h4>A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message:  Undefined variable: output</p>
<p>Filename: controllers/about_us.php</p>
<p>Line Number: 26</p>

</div><div id="MainText">
  <p><h1>Welcome!</h1></p>

  <p>Welcome to the ...
I still get the wierd characters an an error from CI because it couldn't resolve a variable.

This is the first few lines of the view "view_content"
Code:
<div id="MainText">
<p><h1>Welcome!</h1></p>
<p>Welcome to the

Does anyone have any ideas of where to look? Anyone encounter this before?

Thanks,
Jeff
#2

[eluser]got 2 doodle[/eluser]
OK I answered my own question

My header view had the following line in it

&lt;meta http-equiv="Content-Type" content="text/html;iso-8859-1"&gt;

This was output from "fireworks'

the line was changed to

&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;

Now no more strange characters Wink

I guess it just proves that if the problem is not where you are looking then it must be somewhere else.

I have much to learn.

Jeff
#3

[eluser]krif[/eluser]
Just in case, have a look at this post, too: http://ellislab.com/forums/viewthread/90241/




Theme © iAndrew 2016 - Forum software by © MyBB