XF 2.1 Banner won't update unless I re-save PAGE_CONTAINER

Mave

Active member
What I'm trying to accomplish:

Have a different banner image every day, code for this already works.
Code is located in PAGE_CONTAINER

Code:
    <xf:css>
        bannerimage_{{ date($xf.time, 'z') + 1 }}.jpg
    </xf:css>

The problem:

The banner image only updates when I re-save PAGE_CONTAINER
Otherwise the banner image stays cached.

The question:

How would I go about automatically re-loading the PAGE_CONTAINER once a day?
(or another method of fixing this issue)

Thank you in advance!
 
The way you're trying to do it will never work.

What you want is a rotating banner add-on (there are 2-3 to choose from) but the tricky part will be rotating only once per day - not sure why you want to do that, by the way - you may need custom coding for that.
 
Snozzy's Daily Doodle. You can have a different banner every day. For free.
 
Last edited:
Snozzy's Daily Doodle. You can have a different banner every day. For free.
Thanks for this suggestion, however what I want is a banner per day number.
Isn't there any way to automatically re-load the PAGE_CONTAINER cache nightly?
 
XenForo templates are compiled at the time of saving them. There is no way to automatically recompile some templates daily.

You need to put the logic into the file that is called from XenForo to show a different banner each day.
 
Because "bannerimage" is not a stock XF item, could you provide the full code in the template where it's actually displayed? What you show in your first post appears to just be setting it, but where it's displayed (or actually used) is unknown to all of us.

If you're overriding a CSS value for a div or some such thing, you should be doing that in the CSS(LESS) template. Or manually changing the style for the div in the appropriate template(last resort).
 
Last edited:
Top Bottom