I have a method in Categories controller that gets path in catalog of goods 
recursively, like that:

function get_path($cat_id, $path = null) {
        $path_tmp = $path;
        $this->Category->recursive = 0;
        $cat = $this->Category->findById($cat_id);
        if ($cat['Category']['parent_id'] != 0) {
                $cat = $this->Category->findById($cat_id);
                $path_tmp[] = $cat;
                $this->get_path($cat['Category']['parent_id'], $path_tmp);
        }
        else {
                $cat = $this->Category->findById($cat_id);
                $path_tmp[] = $cat;
                /*
                * PAY ATTENTION HERE!!!
                */
                if (isset($this->params['requested']) ){
                        return $path_tmp;
            }
        }
}

If I write it this way, I can not get result form function, althouth function 
works(but doesn't return result).

And if I modify bottom it in this way:

        else {
                $cat = $this->Category->findById($cat_id);
                $path_tmp[] = $cat;
                /*
                * I TOOK if ($this->params['requested'] out of last 'else'!!!
                */
        }
        if (isset($this->params['requested']) ){
                return $path_tmp;
        }
}

it returns walue, but no recursion can be done this way.

Any help?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to