0

Using Concrete5 v8.4.2, I created a custom block for my site where, like the Image Slider, it displays a placeholder when in Edit Mode. When Block Cache is enabled in the Cache & Speed Settings, the public view is cached for the block and the edit mode view is no longer displayed.

The Image slider appears to get around this by using $btCacheBlockOutputForRegisteredUsers = false, but this is a high traffic site, so I really only want to disable the cached view when the page is in edit mode, not for all signed in users.

A previous question Concrete5 (5.7) - Don't cache page or current block on block error is close to what I want to achieve, but I am hoping that I can not render the cached view in Edit Mode, rather than expire the cache (on a trapped error). It would be bad for me to expire the cache, then end up caching the Edit Mode view. This question is also 18 months old and on a previous version of Concrete5, so I am hoping there is a better solution for my issue.

thadmiller
  • 539
  • 1
  • 4
  • 19

1 Answers1

0

Rather than making the edit mode / view decision in php, you can do it in JavaScript. In the block JavaScript, you can test CCM_EDIT_MODE and only run the other scripts and show the normal block view if it is false, or replace the markup with an edit mode marker if it is true.

JohntheFish
  • 167
  • 1
  • 6