setBlockCachedOutput error

Permalink
hi am getting this error when i turn on the block Cache:

Fatal error: Call to undefined method Page::setBlockCachedOutput() in /var/www/vhosts/kitchensbysignature.co.uk/httpdocs/concrete/core/libraries/block_view.php on line 317

i think its because i made a custom template for my auto nav.

am unsure how to go about fixing this.
can anyone take a look please?

The only way i can fix it is if i turn off the block cache and i would prefer to keep this on as it speeds the site up.

i have attached the template.
you can see the auto nav working at this link:
http://www.kitchensbysignature.co.uk/about/...

its the side navigation on that page.

thanks!

1 Attachment

chris123uk
 
chris123uk replied on at Permalink Reply
chris123uk
ok i know that its because I'm using:


$obj = $ni->cObj;
   if ($obj->getCollectionAttributeValue('jquery_move')) {


within my nav foreach loop. does any one have any ideas how i can make a work around for this problem? i need to use getCollectionAttributeValue to check if a attribute is assigned to the page.

i have tried everything.
JohntheFish replied on at Permalink Reply
JohntheFish
The block cache merely saves what the template outputs and serves it up instead of the template, so is potentially workable with any template.

However, it saves the cached copy when you save the block from an edit dialog, so the context can be different and that is where many block cache issues arise. To grossly generalise I would look for where something that exists when a page/block is viewed does not exist when the edit dialog is saved (or vice versa).

A clue may come from what happens when you subsequently clear the block cache (the cache is now re-filled in a view context rather than an edit context). Does the template now work? Is the error the same or different?
chris123uk replied on at Permalink Reply
chris123uk
i don't get the error when I'm logged in. if i clear the cache still errors when logged out. if i remove that code that i last posted it will work without clearing again.

if you view source onhttp://www.elitecoaters.co.uk/login...
you will see that concrete5 is adding some CSS from a package...

not sure why C5 thinks that my bootstrap light box package is part of the login page? i did add this package to a global area in a page type. not sure if that is a reason for this to be added to my login page.

some funny thinks happening lol
alivetech replied on at Permalink Reply
alivetech
I just upgraded an installation from 5.6.0.2 to 5.6.2.1 and am encountering this issue.

Block Cache has been turned off to keep the site up while debugging this.

Did you ever find a solution?
alivetech replied on at Permalink Best Answer Reply
alivetech
Sorry... my fault.

Looks like you used my code from this post:
http://www.concrete5.org/community/forums/customizing_c5/autonav-di...

The problem (which will soon be corrected on that post) is the variable name $obj.

I changed it to $_c based on advice from IRC and suddenly everything worked.

<adajad> "when in doubt, use $fuzzyCat"
chris123uk replied on at Permalink Reply
chris123uk
oh i will try your changed code thanks!

$_c = $ni->cObj;
if ($_c->getCollectionAttributeValue('include_in_gallery_side_nav')) {
alivetech replied on at Permalink Reply
alivetech
Did that fix things?
chris123uk replied on at Permalink Reply
chris123uk
yeeeeeep it a go!
alivetech replied on at Permalink Reply
alivetech
Awesome!

*cough* you should mark mine as best answer *wink wink nudge nudge*