Reputation: 17
I've got a page displaying multiple banners on large-format displays. The banners are placed by hand into an array on one page (main index page per display), and then an include is done on the content-rotation code.
I recently jury rigged code to incorporate an expiration on the banners for when our web designer isn't around to change them after the event on the banner has passed. I made a 2nd array on the index pages and filled it with "mktime(0,0,0,0,0,2020)" (don't expire anytime soon) as dates in the same array spots as the banners from the first array ([1] from the first array would correspond to [1] from the 2nd array) and then added code to the content-rotation page to only display the banner page if the date minus today (time()) was greater than 0.
This is my execution as a java programmer... Obviously I'd want to embed the expiration times into the individual pages but I don't know enough PHP to know how to pull a $expire variable from each page, unless I'm thinking too much like a java programmer. In any case is there a better way of executing this in php?
Upvotes: 0
Views: 114
Reputation: 91922
I would also consider having everything about the banners in the same array. Let each array element be a new array with the banner address and the expiration date. Or even better (this should be familiar to you as a Java programmer): create a class for banners and let each element in the array be an object of the banner class. Let the object have the expiration date as a property!
Upvotes: 2
Reputation: 1354
Maybe try using sessions & session variables? http://php.net/manual/en/features.sessions.php
Upvotes: 0