Recursive function in helper causes "Blank page" - 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: Recursive function in helper causes "Blank page" (/showthread.php?tid=42351) |
Recursive function in helper causes "Blank page" - El Forum - 06-04-2011 [eluser]Unknown[/eluser] Hello, I can't fix this problem... I suspect it's bound to a bug. I hope someone will explain me that it's not a bug, and how to solve it I pass this array to a view (it's a small category tree - for non-italian readers: "idMadre" is the parent_id and "titolo" is the title): Code: Array Then, in my view: Code: if(isset($product_categories)){ "listCats_Single" function is in a custom helper: Code: function listCats_Single($parent, $myArray, $titoloMadre){ Well, the recursion in listCats_Single seems to break everything, when I run the page it returns a blank answer (in Google Chrome: "net::ERR_EMPTY_RESPONSE"). If I remove the call to itself in the function: Code: listCats_Single($key, $myArray, $value['titolo']); I can't get any error, even if I raise the debug level in codeigniter application to "4". Recursive function in helper causes "Blank page" - El Forum - 06-04-2011 [eluser]Unknown[/eluser] Maybe I solved with this modified version of the same function (I'm testing it to verify if it works). Anyway I think that the fact that the previous version doesn't show any error (infinite loop?) can be considered as a bug...? Code: function listCats_Single($parent, $myArray, $titoloMadre){ Recursive function in helper causes "Blank page" - El Forum - 06-05-2011 [eluser]skunkbad[/eluser] Helper functions aren't anything special, so don't blame CI. Take your helper function outside of CI, and you'll probably see you still have an error. Maybe a recursive function like the one here will help: https://bitbucket.org/skunkbad/community-cart/src/575fc7445ed9/application/views/category_menu.php |