Welcome Guest, Not a member yet? Register   Sign In
$this->load->model( adding 2 unwanted line breaks in any view/echo
#1

[eluser]daniel9201[/eluser]
I tried this on codeigniter 1.7.2, apache 2.2 on windows vista and windows xp.


I have a simple xml webservice i am developing being consumed by a Flex datagrid component.

I want to echo out a simple xml string

in my Controller, function testflex
Code:
$xml = '';
        $xml .= "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
        $xml .=    "<entries>";
        

        $xml .=    "</entries>";
the above works fine, echos out fine

now i want to add data in.

Code:
// this is the new line that causes the output to add 2 line breaks at the start
$this->load->model('data_model');

        $xml = '';
        $xml .= "&lt;?xml version=\"1.0\" encoding=\"iso-8859-1\"?&gt;\n";
        $xml .=    "<entries>";
        
        $xml .=    "</entries>";

output now has 2 extra line breaks at the start that i don't want and they do cause an xml error for the consuming component.

See attached screen shots for the view of the source outputed to a browser.
#2

[eluser]danmontgomery[/eluser]
You most likely have an extra line after the closing php tag in your data_model file
#3

[eluser]daniel9201[/eluser]
problem is now fixed, i got rid of the closing [code]?&gt; [code] tag as per the style guide in my model code and it solved my problem.

There were no extra lines in my model code after the [code]?&gt; [code] so i still have no idea why that problem was occurring in the first place.

I now have my Flex datagrid being populated by a codeigniter controller function :-)

Thanks for your help.
#4

[eluser]Unknown[/eluser]
hi
I have the same problem. but eliminating ?&gt; didn't help. I have no idea why $this->load->model cause an extra break line in view?

#5

[eluser]CroNiX[/eluser]
Check for whitespace before your opening php tag.




Theme © iAndrew 2016 - Forum software by © MyBB