Hi there: Thank you for reply. I add some instruction. the code from controller is: $coursedatas = $this->Category->find('all',array('conditions'=>array('Category.id'=>$category)), array( 'contain' => array( 'Curriculum' => array( 'fields' => array('Curriculum.title'), 'order' => array( 'Curriculum.id' => 'desc' ) ) ) ));
In the view,I use <?php //print_r($coursedatas);?> <?php foreach($coursedatas as $coursedata):?> <?php print $coursedata['Curriculum']['title'];?> <?php endforeach;?> but I can't get the value for field Curriculum.title how to get the value for filed Curriculum.title. Thank you. On Fri, Mar 8, 2013 at 6:54 PM, lowpass <zijn.digi...@gmail.com> wrote: > You can use the Set (deprecated) or Hash class to extract an array of > titles. The path you would use: > '{n}.Curriculum.{n}.title' > > Or possibly: > '0.Curriculum.{n}.title' > > You could also get the titles keyed by their IDs. But then you may as > well doa find('list') to get thesame thing a lot easier. > > On Fri, Mar 8, 2013 at 8:21 PM, Joseph zhu <zhubujun...@gmail.com> wrote: > > Hello there: > > Below is array, who can get the value for [Curriculum][title]? > > Thank you so much. > > > > Array > > ( > > [0] => Array > > ( > > [Category] => Array > > ( > > [id] => 3 > > [program] => > > [title] => JOURNALISM > > [public] => 1 > > [timecreated] => > > [timemodified] => 2012-02-20 16:38:13 > > ) > > > > [Curriculum] => Array > > ( > > [0] => Array > > ( > > [id] => 22 > > [college_id] => 3 > > [level] => BA > > [category_id] => 3 > > [code] => JO100 > > [title] => Reporting > > [units] => 4 > > [preunits] => > > [location] => 0 > > [professor] => > > [ta] => > > [language] => 0 > > [schedule] => > > [textbook] => > > [syllabus] => > > [description] => > > [timecreated] => > > [timemodified] => 2012-09-25 17:16:48 > > [program_id] => 5 > > [display] => T > > [precourse] => 0 > > ) > > > > [1] => Array > > ( > > [id] => 23 > > [college_id] => 3 > > [level] => BA > > [category_id] => 3 > > [code] => JO110 > > [title] => Ethical Issues in Journalism > > [units] => 3 > > [preunits] => > > [location] => 0 > > [professor] => > > [ta] => > > [language] => 0 > > [schedule] => > > [textbook] => > > [syllabus] => > > [description] => > > [timecreated] => > > [timemodified] => 2012-06-12 16:59:43 > > [program_id] => 5 > > [display] => T > > [precourse] => 0 > > ) > > > > [2] => Array > > ( > > [id] => 24 > > [college_id] => 3 > > [level] => BA > > [category_id] => 3 > > [code] => JO200 > > [title] => News Writing > > [units] => 4 > > [preunits] => > > [location] => 0 > > [professor] => > > [ta] => > > [language] => 0 > > [schedule] => > > [textbook] => > > [syllabus] => > > [description] => > > [timecreated] => > > [timemodified] => 2012-09-01 12:47:03 > > [program_id] => 5 > > [display] => T > > [precourse] => 0 > > ) > > > > [3] => Array > > ( > > [id] => 25 > > [college_id] => 3 > > [level] => BA > > [category_id] => 3 > > [code] => JO210 > > [title] => Editorial Writing > > [units] => 4 > > [preunits] => > > [location] => 0 > > [professor] => > > [ta] => > > [language] => 0 > > [schedule] => > > [textbook] => > > [syllabus] => > > [description] => > > [timecreated] => > > [timemodified] => 2012-09-25 17:26:01 > > [program_id] => 23 > > [display] => T > > [precourse] => 0 > > ) > > > > [4] => Array > > ( > > [id] => 26 > > [college_id] => 3 > > [level] => BA > > [category_id] => 3 > > [code] => JO300 > > [title] => Advanced Reporting > > [units] => 3 > > [preunits] => > > [location] => 0 > > [professor] => > > [ta] => > > [language] => 0 > > [schedule] => > > [textbook] => > > [syllabus] => > > [description] => > > [timecreated] => > > [timemodified] => 2012-06-12 16:59:43 > > [program_id] => 5 > > [display] => T > > [precourse] => 0 > > ) > > > > [5] => Array > > ( > > [id] => 27 > > [college_id] => 3 > > [level] => BA > > [category_id] => 3 > > [code] => JO310 > > [title] => Advanced Editing > > [units] => 3 > > [preunits] => > > [location] => 0 > > [professor] => > > [ta] => > > [language] => 0 > > [schedule] => > > [textbook] => > > [syllabus] => > > [description] => > > [timecreated] => > > [timemodified] => 2012-06-12 16:59:43 > > [program_id] => 5 > > [display] => T > > [precourse] => 0 > > ) > > > > [6] => Array > > ( > > [id] => 28 > > [college_id] => 3 > > [level] => BA > > [category_id] => 3 > > [code] => JO401 > > [title] => Writing for the Electronic Media > > [units] => 3 > > [preunits] => > > [location] => 0 > > [professor] => > > [ta] => > > [language] => 0 > > [schedule] => > > [textbook] => > > [syllabus] => > > [description] => > > [timecreated] => > > [timemodified] => 2012-06-12 16:59:43 > > [program_id] => 5 > > [display] => T > > [precourse] => 0 > > ) > > > > [7] => Array > > ( > > [id] => 29 > > [college_id] => 3 > > [level] => BA > > [category_id] => 3 > > [code] => JO420 > > [title] => Law and the Courts > > [units] => 3 > > [preunits] => > > [location] => 0 > > [professor] => > > [ta] => > > [language] => 0 > > [schedule] => > > [textbook] => > > [syllabus] => > > [description] => > > [timecreated] => > > [timemodified] => 2012-06-12 16:59:43 > > [program_id] => 5 > > [display] => T > > [precourse] => 0 > > ) > > > > [8] => Array > > ( > > [id] => 30 > > [college_id] => 3 > > [level] => BA > > [category_id] => 3 > > [code] => MC410 > > [title] => Introduction to Online Journalism > > [units] => 4 > > [preunits] => > > [location] => 0 > > [professor] => > > [ta] => > > [language] => 0 > > [schedule] => > > [textbook] => > > [syllabus] => > > [description] => > > [timecreated] => > > [timemodified] => 2012-09-01 16:31:34 > > [program_id] => 5 > > [display] => T > > [precourse] => 0 > > ) > > > > [9] => Array > > ( > > [id] => 31 > > [college_id] => 3 > > [level] => BA > > [category_id] => 3 > > [code] => MC400 > > [title] => Photojournalism > > [units] => 3 > > [preunits] => > > [location] => 0 > > [professor] => > > [ta] => > > [language] => 0 > > [schedule] => > > [textbook] => > > [syllabus] => > > [description] => > > [timecreated] => > > [timemodified] => 2013-02-12 12:56:41 > > [program_id] => 5 > > [display] => T > > [precourse] => 0 > > ) > > > > [10] => Array > > ( > > [id] => 166 > > [college_id] => 3 > > [level] => MA > > [category_id] => 3 > > [code] => JO510 > > [title] => Advanced Reporting > > [units] => 3 > > [preunits] => > > [location] => 0 > > [professor] => > > [ta] => > > [language] => 0 > > [schedule] => > > [textbook] => > > [syllabus] => > > [description] => > > [timecreated] => > > [timemodified] => 2012-06-12 16:59:43 > > [program_id] => 23 > > [display] => T > > [precourse] => 0 > > ) > > > > [11] => Array > > ( > > [id] => 167 > > [college_id] => 3 > > [level] => MA > > [category_id] => 3 > > [code] => JO510* > > [title] => Writing for the Electronic Media > > [units] => 3 > > [preunits] => > > [location] => 0 > > [professor] => > > [ta] => > > [language] => 0 > > [schedule] => > > [textbook] => > > [syllabus] => > > [description] => > > [timecreated] => > > [timemodified] => 2012-06-12 16:59:43 > > [program_id] => 23 > > [display] => T > > [precourse] => 0 > > ) > > > > [12] => Array > > ( > > [id] => 168 > > [college_id] => 3 > > [level] => MA > > [category_id] => 3 > > [code] => JO521 > > [title] => News Writing > > [units] => 3 > > [preunits] => > > [location] => 0 > > [professor] => > > [ta] => > > [language] => 0 > > [schedule] => > > [textbook] => > > [syllabus] => > > [description] => > > [timecreated] => > > [timemodified] => 2012-06-12 16:59:43 > > [program_id] => 23 > > [display] => T > > [precourse] => 0 > > ) > > > > -- > > Like Us on FaceBook https://www.facebook.com/CakePHP > > Find us on Twitter http://twitter.com/CakePHP > > > > --- > > You received this message because you are subscribed to the Google Groups > > "CakePHP" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to cake-php+unsubscr...@googlegroups.com. > > To post to this group, send email to cake-php@googlegroups.com. > > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to a topic in the > Google Groups "CakePHP" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/cake-php/lbe7g3BHgeQ/unsubscribe?hl=en. > To unsubscribe from this group and all its topics, send an email to > cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- God bless you! Joseph -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.