Jump to content

The answer was obvious!


Joss
 Share

Recommended Posts

So, here is the scenario.

I am creating my own little advert management system on my new site. Basically, I have pages under a parent each with ad information in them - google ad code, other ad code, my own ads and so on.

On the parent page, I have a little ProFields table. The first column is a selector where I can choose a position on the website. "Home Page 1st Ad Position" for instance. In the second column, I have a page select where I select one of the ads.

Simple!

Now, just to complicate it, one of my choices I want is "Random". Basically, if I choose this one, for a particular position, then it chooses randomly from all my ads. But how to add a "random" choice?

Well, it struck me that I just create a blank ad called "random" and then I can choose that one. In my code I just put "if ad name is random then getRandom()"

But then, that random selection would also include the random ad.

So, that better be unpublished.

Now I need to change my selector in the table to include an unpublished item.

But then, would the random choice end up choosing the unpublished random ad.... oh god! I could see me causing myself problems.

I scratched my head, stared at errors, walked around the house, shouted at the rain, played some solitaire ...

And then it came to me.

OBVIOUS!!!!

Publish the ad page called "random" and just put an advert in it!

DUH!!!!!!

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...