you can do it in this way.
in your controller just call the function
$this->set('values', $this->Hotelinfo->findList('Hotel'));
and in AppController write the function
function findList($modelname)
{
return $this->Hotelinfo->$modelname->find('list');
}
thats it what ever model u want to call just call with the function
findList('your model name')
hope this help
On Oct 8, 2:00 pm, "Liebermann, Anja Carolin"
<[EMAIL PROTECTED]> wrote:
> Hello everybody,
>
> I have a loop and want to set the linked object name dynamically:
>
> Now :
> ${$controllername} = $this->Hotelinfo->Hotel->find('list');
>
> As you can see I have already the variable dynamically named. Now i want
> to replace 'Hotel' by a varibale.
>
> Something like:
> ${$controllername} = $this->Hotelinfo->$modelname->find('list');
>
> Is this possible? If yes waht would be the correct syntax?
>
> Thank you for any hints!
>
> Anja
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---