3

I'm developing a slideshow feature for a client where they enter entries into a particular weblog (the site is running on EE 1.7x) and set entry and expiration dates on each entry to determine when they start and stop displaying.

In theory, the client could add two entries -- "Entry A" and "Entry B" -- and give them different expiration dates, so that "Entry A" will stop displaying and allow "Entry B" to display. (Only one entry will be displayed at any given time.)

I have a jQuery script that will count down to the expiration date for "Entry A". When the countdown reaches 0, it reloads the page, and then "Entry B" will be displayed. (There's probably a more elegant way to handle the refresh, but I wanted to keep things simple initially.)

However, that isn't what happens. Even after "Entry A" has expired, which should stop it from displaying, and the page reloads, "Entry A" still displays instead of "Entry B". "Entry B" doesn't display until I go into the CP and clear all of the caches.

Here's the code that I'm using to display the entries:

{exp:weblog:entries weblog="foo" status="spotlight" dynamic="off" limit="1" disable="categories|member_data|pagination|trackbacks" orderby="date" sort="desc" show_expired="no"}

So here are my questions:

1) Am I handling/treating the expired entries correctly? Or is my understanding flawed?

2) If this is a caching issue, is there a way to disable all caching for this particular page? I've disabled all of the caching that I can in the CP, and yet, something is still obviously being cached.

3) If there's no way to completely disable caching, is there a third-party add-on that lets you clear caching on the front-end via, say, a special URL, e.g., http://www.domain.com/?cache-refresh=1 (I know there are some performance implications here, but I'm kind of at wit's end right now.)

Any ideas?

1 Answer 1

1

Make sure Cache Dynamic Channel Queries? is turned off.

This feature is found under Admin ‣ Channel Administration ‣ Global Preferences.


Make sure you aren't using tag caching in the template. The code will look like this cache="yes" refresh="10" and will be on your channel:entries tag.


It's possible this might also be caused by your browser cache. You can test this by adding the following to your header:

<META HTTP-EQUIV="Pragma" CONTENT="no-cache" />

There is no way that I know to trigger cache clearing with the URL. But you could probably write an addon to do it. The core code for cache clearing is here: /system/expressionengine/libraries/functions.php. Line 1138 in EE v2.5.5, function clear_caching(). That's about as much direction as I can give you on this topic. I don't know offhand where the code is in EE1 but it shouldn't be too hard to find with a little searching.

3
  • As it turns out, it was primarily a browser caching issue, not an EE caching issue. And unfortunately, I don't think there's any reliable way, via META tags or anything else, to force a browser to refresh its cache... probably for security reasons, I imagine. Thanks for your help! Commented Jan 23, 2013 at 16:18
  • <META HTTP-EQUIV="Pragma" CONTENT="no-cache" /> Didn't work for telling the browser not to cache the page?
    – Anna_MediaGirl
    Commented Jan 23, 2013 at 16:49
  • I could never get it to work for me. Commented Feb 1, 2013 at 4:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.