SimpleXML Object is not passed to view |
[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.
[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.
[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
[eluser]scatterscatter[/eluser]
I was having a similar issue until I embedded it into an array, like: Code: $process['xml'] = $xml = new SimpleXMLElement($data);
[eluser]pixelknipsr[/eluser]
Thanks for your help :-D I finally found an answer: I added this line: Code: $data['xml'] = $outputarray; cheerio. |
Welcome Guest, Not a member yet? Register Sign In |