Sorry I should be more clear.. When the page is first rendered I have a table generated with content in it.
Once the page is up there are some selection boxes to allow you to filter the contents of the table. So the first time the page is rendered there is no ajax call, its just rendered. When the user selects a filter, I make an ajax call to have the table re-rendered without re-loading the page. So my dilema.. My controller has the method bureauPage which has a view bureau_page.thml This has a div inside it <results_table> $this->render('results_table'); </results_table> When its first rendered it needs to render the table which I could do with regular html calls or multiple calls to renderElement. Now in my code when you apply the filter I need to update the results_table div so in the controller I have render('results_table', 'ajax'); So if I didn't user $this->render('result_table') in the view bureau_page.thml I'd have to have to copies of the results_table php code, one when the page is first created, and one when I need to update the div due to the ajax call. Can you tell me a better way to do this since I may just be going about it all wrong. Cheers Grant ........................................... > b l u e t u b e i n t e r a c t i v e. .: grant davies .: 404.428.6839 (c) .: 708-983-1577 (F) > [EMAIL PROTECTED] > http://www.bluetube.com/bti -----Original Message----- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of AD7six Sent: Monday, December 04, 2006 3:17 AM To: Cake PHP Subject: Re: Rendering a view for ajax and non ajax Hi Grant, It's probably wise to take a step back and look at your code with an eye on what methods you should be using. You should not be calling render in your view, or was that typo? Your message implies that you have table_contents.thtml and table_content.thtml, but I canĀ“t really make out what you have or want to achieve. Regarding ajax and not: There is no need to create 2 views for the same method, irrespective of the contents that is obviously a duplication. Just include the requestHandler component - you then don't need to do anything to have a layout for a normal request, and not for an ajax request. Generally speaking, it's unnecessary for controller or view code to be aware of whether it's an ajax call or not when processing a request. HTH, AD7six Please note: The manual/bakery is a good place to start any quest for info. The cake search (at the time of writing) erroneously reports less/no results for the google group. The wiki may contain incorrect info - read at your own risk (it's mainly user submitted) :) You may get your answer quicker by asking on the IRC Channel (you can access it with just a browser here: http://irc.cakephp.org). On Dec 4, 4:29 am, "Grant Davies" <[EMAIL PROTECTED]> wrote: > Hi guys, > > I have a view where I need to render the same content when its an ajax > call another time when its first page render. I don't want a > duplicate of the table_contents.thtml file even if its uses elements > to create itself. So in the table_content.html view file has : > > <div id='table_content'> > $this->render("table_contents"); > </div> > > and in the controller when I do an ajax update I do : > > $this->render('table_contents', 'ajax'); > > the issue is when you render a view inside a page causes it to render > the view with its layout so it closes the html tag and the body tag at > the end of the render call, and anything after is techinically invalid > since the html tag has been closed. So my initial page render is > actually wrong due to the table_contents being a view file and not an > element file. > > I know you can use elements for "content" which I do to actually > create the details of the table_contents.thml but when the page loaded > the first time its table_content div is the same as when its called > from ajax and I hate having a duplicate view thml file. > > Cheers > Grant > > ...........................................> b l u e t u b e i n t e r > a c t i v e..: grant davies > .: 404.428.6839 (c) > .: 708-983-1577 (F) > > > [EMAIL PROTECTED] > >http://www.bluetube.com/bti<http://www.bluetube.com/bti> > > A Tribal Chicken Designs Affiliate <http://www.tribalchicken.com/> > > small.jpg > 2KViewDownload --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---