Closed (fixed)
Project:
Marinelli
Version:
5.x-2.0
Component:
Code
Priority:
Minor
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
14 Mar 2008 at 23:44 UTC
Updated:
29 Aug 2008 at 15:52 UTC
I love the random banner graphic idea but it's not being random for me. When I navigate around the site, opening up pages to create a forum post, going into admin mode, etc, the graphic doesn't change eventhough I have 6 in the directory.
Now if I do a hard refresh it does change.
I navigated around this site:
http://www.signalkuppe.com/marinelli/
and it randomizes just great. What am I missing?
Thanks!
Comments
Comment #1
Lioz commentedwell that's strange.
OS? Browser?
Comment #2
frazzle-1 commentedIE7 and Firefox (latest). I use Windows XP.
The site is http://www.bringohiohome.com/ and there are 17 images in the directory.
Comment #3
Lioz commentedi just checked your site, everything is ok i can see the rotating banners
maybe a cache issue?
Comment #4
frazzle-1 commentedWell, I'm puzzled.
Since I didn't know which cache you were referring to, I cleared out my cache in IE and the drupal cache (and all cache is turned off in drupal in any case) and it's still not rotating for me unless I do a hard refresh.
I just visited again:
http://www.signalkuppe.com/
and I click around and the banner rotates for me.
It doesn't seem to be my browser since it worls elsewhere but not on my site.
It doesn't seemt to be my site since it works for you but not for me.
What am I missing?
Comment #5
bitsize commentedI'm having the exact same issue.
On my local host: xampp, the banner rotates w/ every click in both ie7 and FF.
On my live host: unix (cpanel), the first banner loads but never changes. Only a hard refresh does the trick.
I don't have caching set for drupal at all.
Any suggestions?
Comment #6
Lioz commentedi think something on your host is blocking the banners.
any ideas?
Comment #7
dchapiesky commentedIt is possible that you are experiencing memcache at your provider's internet gateway....
Internet
^
firewall
^
web server (Upstream server) <=====> memcache (gigabytes of memory)
^
virtual servers
^ ^
Your website | My Website
^ ^
mySQL | mySQL
Not a very good diagram but...
Your site is probably stored in a "virtual server" - meaning it is one of many sandboxes running on a single physical server. When a request comes in from the internet, it passes through their firewall and on to their primary webserver. It determines the location of your virtual server and passes the request on to your site. It keeps a connection open waiting for the page to return.
After the page (i.e. your banner) is returned, it passes the page back to you, AND stores it in memcache using the page URL as the key. The next time that url (www.mysite.com/images/mybanner.jpg) is requested, the memcache is checked with the url again as the key.
Your original banner is returned and your website never even get's to think about it long enough to rotate....
There are HTML tags to state that a page's content is "non-cachable"... that might be the way to go....
Daniel
(memcache actually kicks but... how would you like to have a hash database in 32 gigabytes of RAM?)
Comment #8
frazzle-1 commentedSo what are these HTML tags to make the page "non-cachable"?
Thanks!
Comment #9
dchapiesky commentedSee: http://www.i18nguy.com/markup/metatags.html for description...
See: http://www.htmlgoodies.com/beyond/reference/article.php/3472881 for how to use it and caveats...
You should be able to modify page.tpl.php and insert the code in the appropriate place...
BTW - I am experiencing the same problem with IE7 and my local server.... So it seems it is the browser cache that is being funky...
I'm going to try this stuff myself and will let you know... but please try yourself also since I cannot promise when (today, tomorrow, next week) I can get to this.... I'm putting another pot of coffee on right now... so keep your fingers crossed...
Daniel
Comment #10
dchapiesky commentedFIXED (only two cups of coffee later...) !
See below for mod.
-------------------------------------
Research:
I found an even better description here:
http://www.mnot.net/cache_docs/#META
This link explains what is happening in the fix below...
-------------------------------------
Drill down to marinelli/img/banners and edit rotate.php
find the following code at the bottom of the file:
Now insert the following code between "header()" and "readfile()" :
resulting in:
--------------------
Click refresh and see the banners change....
Remember that the randomness is based on how many banners you have and does not guarantee that the same banner won't be served twice... in a random manner
Add more banners and the less likely you will see the same twice.
The code above tells your browser, any internet caches in between, and the site server that the image being served should not be cached. It also says that the date the image expired and should be refreshed is in 1998.
The Expires line seems to be directed towards internet caches on the actual Internet backbone.
The Cache Control line seems to be directed at your web server such as apache... (which needs modules loaded to understand it...)
The Pragma line seems to be directed at browsers which understand it...
Try this out. I'd love to know if it also works for you.... (be sure to add more banners [I tested with only three banners and checked my network connection with ethereal - the banners were requested by the browser each time - so the statistics of the issue were confirmed as well as the caching...])
Daniel
Comment #11
Lioz commentedgreat post dchapiesky!
i'll put this patch in the next release!
Comment #12
frazzle-1 commentedWorks for me!
I had to do one hard refresh (to load the new PHP code) and then it began to work for me.
Thanks!
Comment #13
frazzle-1 commentedComment #14
bitsize commentedPerfect! Thanks so much for the great post.
Comment #15
Lioz commentedfixed in 6x-1.7!
Comment #16
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #17
douglaslopezt commentedthanks for the fix, it works good
Comment #18
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.