![]() |
SimpleXML Object is not passed to view - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: SimpleXML Object is not passed to view (/showthread.php?tid=9288) |
SimpleXML Object is not passed to view - El Forum - 06-20-2008 [eluser]pixelknipsr[/eluser] Hi there, I hope that someone has the answer to my problem :-) I'd like to pass a simplexml object from my controller to my view. Here's the code: Code: function loadxml($url) The XML is correctly loaded and the $outputarray has the correct data are it. Still I get a "undefined variable" in my view :-( Can't I transfer such an object? I also tried to pack everything into an array as described here: http://codingforums.com/showthread.php?t=87283 and it didn't work either. Thanks for help me out. SimpleXML Object is not passed to view - El Forum - 06-20-2008 [eluser]Raiko[/eluser] Can we see your view? Also, in the loadxml function, you're returning before you close curl. You can't do that. The close_curl function is never getting called. SimpleXML Object is not passed to view - El Forum - 06-20-2008 [eluser]pixelknipsr[/eluser] Hi Raiko, Thanks pointing out my error in the loadxml function. Here's my little class: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); And here's my view: Code: <?php I get this error: A PHP Error was encountered Severity: Notice Message: Undefined variable: outputarray Filename: views/listing_view.php Line Number: 2 SimpleXML Object is not passed to view - El Forum - 06-20-2008 [eluser]scatterscatter[/eluser] I was having a similar issue until I embedded it into an array, like: Code: $process['xml'] = $xml = new SimpleXMLElement($data); SimpleXML Object is not passed to view - El Forum - 06-20-2008 [eluser]pixelknipsr[/eluser] Thanks for your help :-D I finally found an answer: I added this line: Code: $data['xml'] = $outputarray; cheerio. |