Recursive function in helper causes "Blank page" |
[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".
[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){
[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...y_menu.php |
Welcome Guest, Not a member yet? Register Sign In |