First, you need to set up your associations in your Model files,
something like:

var $hasMany = array("HousePlan")

in your app/models/community.php, and

var $belongsTo = array("Community")

in your app/models/house_plan.php


Then, when retrieving your HousePlan model in
house_plan_controller.php, first set the $this->HousePlan->recursive to
2, this will retrieve two levels of associations from a HousePlan.  The
first level is to get the HousePlan's Community, the second level will
get the Community's House Plans.

Your house_plan_controller.php view() function will probably be
something like

function view($id){
  $this->HousePlan->recursive =2;
  $house_plan = $this->HousePlan->read( null, $id );
  $this->set("house_plan", $house_plan);
}

Now in your views/house_plan/view.thtml, have a look at the $house_plan
variable, it will be an associative array with all of the Community
details, and that Community's House Plans.

For more details on associations, check out
http://manual.cakephp.org/chapter/models


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to