$modelname = 'Hotel'
${$controllername} = $this->Hotelinfo->$modelname->find('list');

Seams to work. Sometimes life is easier than expected ;-)

Anja

-----Ursprüngliche Nachricht-----
Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von 
Liebermann, Anja Carolin
Gesendet: Mittwoch, 8. Oktober 2008 11:00
An: cake-php@googlegroups.com
Betreff: Dynamic model names in loop - possible?


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 cake-php@googlegroups.com
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