Here's the code placed inside the QUOTES block I made:

<?php
$choice = rand(1,23);
include('sites/default/files/quotes/'.$choice.'.txt'); 
?>

(1 - 23 is the range of text files living in the referenced quotes directory.)

When visiting the websites pages NOT logged in, all the different pages display different quotes - but retain those same quotes on each page indefinitely (as far as I can tell). As soon as I log in, the quotes change and continue to change as I move around.

I opened a different browser (again NOT logged in), and compared the same web-pages between logged-in and not-logged-in browsers. The NOT logged in only changed when I cleared the cache from the logged in browser.

Is there a setting that controls session refreshes, and might account for a difference between anonymous and authenticated sessions?

Comments

sovarn’s picture

This is because as you mentioned any block output is cached.

One method is to let jquery load a text using ajax, that way output is not cached. If you need help with that, just ask.

thorshammer’s picture

... as I mentioned Drupal DOES refresh the quote on every page change as hoped, when I'm logged in. I can stay on one page and click refresh to my heart's content, and get a different quote each time. Not so when I do the same thing while logged out. The LOGGED OUT session only gets new data when I clear the cache manually from another logged-in browser.

I'M TRYING TO FIND OUT WHY THE DIFFERENCE.

BTW, how do you know "any block output is cached" by Drupal? Apparently not so, when you're logged in...

sovarn’s picture

Thats the way drupal handles it.

You can enable block cache under the performance, this will mean the blocks for logged in users will be cached.