Re: Cache actions vs elements

2010-10-11 Thread Sarpidon
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  on my elements but it does not seem
to give the result I need.
For example I have this element:

if($this->params['controller'] == 'frontapage'): display image 1 else:
display image 2 endif;


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  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  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  wrote:
>
> > > Hello.
>
> > > I have this layout
>
> > > 
> > > element(header, array('cache'' => true); ?>
> > > 
> > > element(footer, array('cache'' => true); ?>
> > > 
>
> > > 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Cache actions vs elements

2010-10-10 Thread euromark
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  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  wrote:
>
>
>
> > Hello.
>
> > I have this layout
>
> > 
> > element(header, array('cache'' => true); ?>
> > 
> > element(footer, array('cache'' => true); ?>
> > 
>
> > 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Cache actions vs elements

2010-10-10 Thread calzone
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  wrote:
> Hello.
>
> I have this layout
>
> 
> element(header, array('cache'' => true); ?>
> 
> element(footer, array('cache'' => true); ?>
> 
>
> 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Cache actions vs elements

2010-10-10 Thread Sarpidon
Hello.

I have this layout


element(header, array('cache'' => true); ?>

element(footer, array('cache'' => true); ?>


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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en