Thank you for your replies. I am still somewhat confused. So how do I cache view.ctp ?? it is not an element, it is displayed through $content_for_layout
I've tried adding <cake:nocache> on my elements but it does not seem to give the result I need. For example I have this element: <cake:nocache> if($this->params['controller'] == 'frontapage'): display image 1 else: display image 2 endif; </cake:nocache> This is not working. When a user requests 'frontpage' the element is cached with display image 1 and stays like this even if the user requests another page. If the cache is deleted and the user requests a page other than the frontpage image 2 is displayed and stays like this.... I guess I have to use two different cached elements? Give them a different key, one for the frontpage and one for the other pages? But this is not very efficient is it? On Oct 10, 5:33 pm, euromark <[email protected]> wrote: > i would include the helper but NOT use the > var $cacheAction = '1 hour' > > now set up your elements and cache them as you did before > > this way the page itself should not be cached (no cacheAction > declared) > but the elements should! > > On 10 Okt., 16:28, calzone <[email protected]> wrote: > > > I believe cache action is used to cache the entire request. > > > You would have to use nocache on the sections of your ctp file you > > don't want cached > > To cache just the elements, you would have to cache the actions > > associated with each element. > > > On Oct 10, 2:42 am, Sarpidon <[email protected]> wrote: > > > > Hello. > > > > I have this layout > > > > <body> > > > <?php echo $this->element(header, array('cache'' => true); ?> > > > <?php echo $content_for_layout; ?> > > > <?php echo $this->element(footer, array('cache'' => true); ?> > > > </body> > > > > This creates two cache files in tmp/cache/views > > > > on a controller I have this: > > > function view() { > > > var $cacheAction = '1 hour' > > > > } > > > > for some reason caching View caches the whole page again, including > > > header and footer. Is this how is supposed to work? Because this is > > > causing problems when the element has dynamic content (like latest > > > news). > > > I thought caching an action (like view) will only store the contents > > > of view.ctp and not the whole layout. > > > > Am I missing something? > > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
