• ZAP

    (@michaelzap)


    Is there a way to exclude only certain elements from caching? For example, on one website I would like to show random banners on posts, but as these are outputted to the page (not loaded dynamically via javascript), the same banner always appears for that post after the cache is created. On another site I would like to show a random selection of related posts on each post page, but again after the cache is created the same posts are always shown. There are many other situations where this might be an issue.

    What I’m imagining is a way to include code in my HTML (e.g., comments that flag the beginning and end of an element that should not be cached, or perhaps a CSS class or other attribute that would have the same effect) that would exclude parts of the page from being cached.

    Is there a way to do this?

    THANKS for the great plugin!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author adeelkhan

    (@adeelkhan)

    As per your concerns(which I understand), do you want to exclude some elements on the page not the entire page from cache?

    Please correct me if I am wrong?

    Thread Starter ZAP

    (@michaelzap)

    Yes – that is correct.

    I would like to be able to cache most of a page but not some elements (depending upon the situation I can imagine many such uses, but the easiest example is a random banner image).

    Previously I used a CMS that had caching that worked like this, and I used it all the time for mixing dynamic and cached content.

    Plugin Author adeelkhan

    (@adeelkhan)

    You may exclude the URL under the “Never Cache URL” option as well as you can exclude the specific JS and CSS files under the “Exclude CSS” and “Exclude JS” options.

    Thread Starter ZAP

    (@michaelzap)

    Yes. Those are both very helpful options, and I use them. However what I want to do here is to exclude certain parts of a page from caching (but otherwise cache the page).

    For example, I may have a page that is something like this:

    header
    title
    content
    * other content that you may like -> should be random! *
    footer

    So what I’m looking for is a way to exclude that specific block of the page (or multiple such blocks) from being pre-rendered and cached, but I want the rest of the page cached. This is not content loaded in a separate iframe or something like that. It’s on-page content, but I would like to be able to do something like include comments in my template files for the beginning and ending of blocks that shouldn’t be cached or use some other method of setting those apart from the caching system.

    I used to do this in a different CMS that I used back in the day (MODx), so I’m hoping that I can here also.

    The best solution that I’ve found so far is just to set the cache time to something short (like six hours) so that at least this content rotates occasionally, but that’s not a good solution (it just kind of makes the problem less obvious).

    Ideas?

    Thread Starter ZAP

    (@michaelzap)

    Is that just not possible given how Breeze works?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Exclude some page elements from cache’ is closed to new replies.