Hello, After reading the manual and other search results, i still didnt find the way to make a good use of Elements when using Ajax.
Let's say i have a model "User" and in my controller, a method called "index" that list my registered users. Since I'll re-use this user list in my application, i decided to put it in a Element called "_user_list.ctp". So from my views/users/index.ctp, i just have to use $this- >renderElement('_user_list', $users) and it works fine ! Now, i want to use Ajax to get that list rendered (I'm using Prototype library for Ajax calls) into an element (div or table ..), but i can't render an Element (views/elements/users/_user_list.ctp in this case) directly from a controller. So currently, i'm using a file in my view directory ( views/users/ user_list.ctp ) that is able call an Element ( views/elements/users/ _user_list.ctp ) and in my user controller, i'm using : this- >render('user_list'); Is there any way to do it better than this ? I don't think i'm doing it right ! ^^ A solution is that we should to be able to call renderElement() from controllers. function index(){ ... if($this->RequestHandler->isAjax()){ $this->renderElement('users/_user_list'); // with autoLayout set to false automatically } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---