|
|
Joined: Feb 2007
Posts: 329
Yarp™
|
Yarp™
Joined: Feb 2007
Posts: 329 |
As requested at ubbcentral, random adds. It puts the contents of a random post in a set topic in a variabele that can be used in any template. open /ubbthreads.php find require_once("libs/ubbthreads.inc.php"); add below: $query = " SELECT POST_BODY FROM {$config['TABLE_PREFIX']}POSTS WHERE TOPIC_ID = 6317 AND POST_BODY != '' order by rand() limit 0,1 "; $sth = $dbh->do_query($query,__LINE__,__FILE__); list($advertisement) = $dbh -> fetch_array($sth,__LINE,__FILE__); $config['ADVERTISEMENT'] = $advertisement;
You need to replace the 6317 topic value to the topic you want your banners to come from. Example use: In a template, on any spot you want you can add {$config.ADVERTISEMENT} and it will be replaced with that random content from that topic.
|
|
|
|
Joined: Mar 2000
Posts: 21,079 Likes: 3
I type Like navaho
|
I type Like navaho
Joined: Mar 2000
Posts: 21,079 Likes: 3 |
One "Ad" per post in that topic?
|
|
|
|
Joined: Feb 2007
Posts: 329
Yarp™
|
Yarp™
Joined: Feb 2007
Posts: 329 |
|
|
|
|
Joined: Jan 2000
Posts: 5,833 Likes: 20
UBBDev / UBBWiki Owner Time Lord
|
UBBDev / UBBWiki Owner Time Lord
Joined: Jan 2000
Posts: 5,833 Likes: 20 |
too bad, i'd hate to have the same ad displayed three times on one page lol
|
|
|
|
Joined: Feb 2007
Posts: 329
Yarp™
|
Yarp™
Joined: Feb 2007
Posts: 329 |
It's easy to extend to display guarenteed different ones. Just change the limit in the query, and use different variables.
That's the way I have it running at a client.
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 417
Joined: November 2001
|
|
Forums63
Topics37,575
Posts293,930
Members13,823
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|
|