i have section table have this fields (id ,parent_id ,lft,rght,name)
when sent $id it will check by this id the parent_id field,then if it
is null,it will search for his children,how to do this..

i write this code but it is wrong

function view($id = null) {

            // find section in database
        $section = $this->Section->findById($id);
            // set the section for the view
            $this->set(compact('section'));
 // if find id  check parent_id field and if its is null then find his
children
         if ($section['parent_id']== null){
           $this->Section->Article->children($id) ;
         }else{
             // else find parent only
          $this->Section->findbyid(parent);

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to