vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Advert Management (https://vborg.vbsupport.ru/showthread.php?t=39074)

Scott MacVicar 05-25-2002 10:00 PM

Advert Management
 
This is a script to allow you to manage the adverts on your forums, you can have any sort of advert you can imagine there is no actual limit with this hack to what it can be, javascript, flash, image, text and images.

You add adverts to a category or a forum or the whole board. If the category has child forums they will inherit the adverts as well as their own adverts if they have any.
Adverts can have a set exposure such as 10,000 views and once it has reached that it will stop.

It fills a variable called $advert which you just place in any template, such as the header, you can also use variables and replacements within the adverts, such as $bbuserinfo[userid] for the persons userid in a link within an advert.

Updated June 9th at 19:44 GMT

Added date limits and options for unlimited exposures.
To upgrade from an older version, reapply code in global.php, upload ads.php and run this sql query to alter the ads table you made.

[sql]ALTER TABLE `ads` ADD `time` INT(10) DEFAULT '0' NOT NULL;[/sql]

[sql]ALTER TABLE `ads` ADD `wholeforum` SMALLINT(1) DEFAULT '0' NOT NULL;[/sql]
If you already run that query though are still experiencing problems with the time always being January 1st run

[sql]ALTER TABLE `ads` CHANGE `time` `time` INT(10) DEFAULT '0' NOT NULL[/sql]

New features include showing the advert on the entire forum by using a radio button, some highlighting in the admin panel, italic name indicates the time period has ended and a bold name means the advert has met its quota for exposures.

You must chance RAND() to RAND(NOW()) if you have mysql 3.23.52 or above

Scott

Scott MacVicar 05-26-2002 04:33 PM

And before someone asks for a screenshot.

Neopiper 05-26-2002 05:08 PM

this is awesome :) what about exposure that have no limits?

RDX1 05-26-2002 05:18 PM

oh god, he comes hack of the month ;)

Kumaro 05-26-2002 05:31 PM

whats an advert? and then explain again what this does?

Scott MacVicar 05-26-2002 05:35 PM

Em its an advert

http://www.dictionary.com/search?q=advertisement

snyx 05-26-2002 06:33 PM

^^^ ROFL!
anyways... great man I was looking for this hack last night actually, I will post when I get her installed.

cheers PPN.
-myles

Parker Clack 05-26-2002 06:34 PM

PPN:

Great hack. Have your figured out a way to make it count the number of times it has been clicked on like a link?

I added a maketableheader2 with a colspan of 4 in the adminfunctions.php file as the default is only a colspan of 2.

Parker

Scott MacVicar 05-26-2002 06:45 PM

Oh the maketable problem hold on you don't need another function you just need to adjust the variables passed into the function.

Adjusting ads.php just now.

Scott MacVicar 05-26-2002 06:48 PM

If you wanted it to count the number times a link had been clicked on you have to start creating a file in which to hold the link information and that means you have to start doing more work and you wouldn't really be able to use the adverts for other media like javascript.

Ill have a think about it though.

Parker Clack 05-26-2002 07:37 PM

PPN:

Ok, I will see what you do. Thanks.

I added another row so that the actual banner would show up too.

Below the last </tr> I added

echo "<tr>";
echo "<td colspan='4' align='center'>$ads[advert]</td>";
echo "</tr>";

and I added the ability to reset the count on the advert to zero if you wanted by adding

// ###################### Start Reset #######################
if ($action=="reset") {

doformheader("ads","zero");
makehiddencode("adid",$adid);
maketableheader("Confirm reset");
makedescription("Are you sure you want to reset this advert");
doformfooter("Yes","",2,"No");

}

// ###################### Start Kill #######################
if ($HTTP_POST_VARS['action']=="zero") {

$ad = $DB_site->query("SELECT name FROM ads WHERE adid='$adid'");
$DB_site->query("UPDATE ads SET exposed=0 WHERE adid='$adid'");
echo "<p>Advert $ad[name] has been reset</p>";
$action="list";

}

and just link to reset.

Thanks again for a great hack. This is something that I thought should have been included with vBulletin from the start.

Parker

scsa20 05-26-2002 08:18 PM

Quote:

Originally posted by PPN
Em its an advert

http://www.dictionary.com/search?q=advertisement

lol, dictionary.com, the only place where I go to for defantions :D

Scott MacVicar 05-26-2002 08:51 PM

Yep but that can cause problems showing the ad if it has alot of ads or if its javascript with \ in it as it would be stripped and could cause problems.
The reset thing i'll add to the release then.

Scott MacVicar 05-26-2002 09:08 PM

Uploads ads.php from the zip again to get the reset feature working on your board, you can use this to reset your ad hits to start exposures at 0 again.

Velocd 05-26-2002 09:57 PM

advert eh? you're the first person I have met abbreviate advertisements into advert, instead of plainly referring to it as an ad.

nonetheless, excellent hack :D

Sparkz 05-27-2002 12:33 AM

If that is the case, you need to get out more, Velocd :P

I think advert occurs pretty commonly...

duke 05-27-2002 02:57 AM

This is a great

sugestion
1. what if you want to have two different rotatons one at top and obe at bottom you would need to variable's is that a posability to add.

2. there should be a way to set the banner to unlimited exposers

3. rotate the ad in all or one forum to beable to choose two or three forums right now it is a little limited to all of one catagory or one forum

Neo 05-27-2002 05:45 AM

Would you post a pic of what it looks like from the users end?

Parker Clack 05-27-2002 10:43 AM

neo:

The upper right hand banner is what the enduser will see.

Floris 05-27-2002 11:36 AM

It works very nice :) I expected to find instructions for many files, but this was very quick and easy. Great hack!

One little tweak me and my users want, is to exclude the showthread and postreply pages. Or at least an option for the admin to also show on those pages, or not.

Another little tweak is the option to show certain banners for unlimited time.

Jeremy W. 05-27-2002 11:58 AM

So, does this do rotations if there are more then one ad for a certain forum?

Parker Clack 05-27-2002 12:19 PM

Jeremy:

Yes as long as you have them in the same forum they will show up together. You chose the forum(s) that you want the banner(s) to show up in. So you can have multiple banners for a single forum.

PPN:

I did notice though if you have more than one banner for a forum though it will create multiple of the banners. Say I put in banner1 and banner2 to show up in forum1. When I go back to the admin for the banners I will see three banner1s show up and 1 banner2. Now if I go back and delete the extra banner1s they will not show up again but when you first add them they are often times multiples.

Parker

Scott MacVicar 05-27-2002 12:28 PM

Will test it now, this shouldn't really happen as there is only one query. Does it appear 3 times when you add banner1 or does it only appear 3 times when you after you add banner2?

xiphoid: to exclude pages you have to start doing more checking, what files are you wanting to exclude? Tell me and i'll try and get the code done to do it.

Floris 05-27-2002 12:51 PM

showthread.php (maybe) We are still discussing this

but at least:
newthread.php
newreply.php
editpost.php
report.php
postings.php

Scott MacVicar 05-27-2002 01:19 PM

Not many files then ;)

You'll need to add this code below

PHP Code:

eval("\$advert = trim(\"".str_replace("\'""'"addslashes($advert['advert']))."\");"); 

PHP Code:

if (substr($PHP_SELF,-strlen('newthread.php'))=='newthread.php' or substr($PHP_SELF,-strlen('newreply.php'))=='newreply.php' or substr($PHP_SELF,-strlen('editpost.php'))=='editpost.php' or substr($PHP_SELF,-strlen('report.php'))=='report.php' or substr($PHP_SELF,-strlen('postings.php'))=='postings.php') {
  
$advert='';



Floris 05-27-2002 01:46 PM

You the man :)
(and firefly ofcourse)

I will tweak it now :) (global.php I assume)

[update]
Yep, global.php and it works perfectly !!

Sparkz 05-27-2002 02:43 PM

I am pretty sure I am a man too.
/me checks between his legs...

Yup, definitely a man...

Parker Clack 05-27-2002 04:53 PM

PPN:

It happens after I add the second banner. The first one will get tripled.

I also noticed that the move function doesn't work with having the $advert array in global.php. Somehow it messes with postings.php and the move function thinks that you are trying to move it back to the same forumid. If I put the code in forumdisplay.php and showthread.php it works as I want it.

Would putting the check that you have written above resolve the issue with postings.php?

Thanks,
Parker

Henry-RS 05-27-2002 06:19 PM

Ok, I installed this without a problem, but there doesn't seem to be a feature that rotates the banners if you add two different ones to one specific forum, using the one "$advert" variable.

How can I make them rotate, by picking random banners that were assigned to that area?

Parker Clack 05-27-2002 06:31 PM

Henry:

If you put more than one banner for a forum the script will randomly pick the banner to display out of the ones that you have assigned to that forum area. From what I have experienced they are about one a one to one footing. Your mileage may vary.

Parker

inetd 05-27-2002 07:51 PM

Quote:

Originally posted by duke
This is a great

sugestion
1. what if you want to have two different rotatons one at top and obe at bottom you would need to variable's is that a posability to add.

2. there should be a way to set the banner to unlimited exposers

3. rotate the ad in all or one forum to beable to choose two or three forums right now it is a little limited to all of one catagory or one forum

Good suggestion!
And one od the best hack of course :) :) :D
PPN, please realize this suggestion. I need this too . ;)

inetd 05-27-2002 08:53 PM

Please add shows ad by time.
Example: 2 days
After 2 days ad not show.

Thanks for this!

Kumaro 05-28-2002 12:16 AM

oh, okay...great. looks like an excellent hack.

Scott MacVicar 05-28-2002 10:27 AM

Bah thats my bad, i set $forumid in the global code, i'll change that until then em thats broken :D

WIll update it in a bit.

Will do some of the suggestions, To pick multiple forums might cause a problem cause the query will be more complicated but i should be able to find something.

Floris 05-28-2002 05:36 PM

WIll update it in a bit.

It has been a bit,
and I just upgraded to 2.2.6 RC,
and re-installed your hack -redownloaded it too-

Works like I want to.

Scott MacVicar 05-28-2002 10:53 PM

Ive updated it now, sorted the forumid problem. Added unlimited exposures and the time limit.

The next problem is multiple banners and I've decided that allowing it for multiple forums would prove too dificult after some testing was done but I'll consult some people just to be sure.

inetd 05-29-2002 02:45 AM

I very waiting new version :)
PPN, good work :)
I will install new version after release :)

Parker Clack 05-29-2002 03:07 AM

PPN:

Looking good. I have it installed and is working just fine on my board. Your new coding resolved the issue with the move/copy/move thread with redirect issue I was having.

Thanks again,

Parker

Parker Clack 05-29-2002 04:55 AM

PPN:

I am not sure if this is a bug or not or just something not working right on my board but when I installed it before midnight the time limit function correctly identified the server date and worked great. Then I noticed that the banners stopped showing up after midnight and when I went to edit the file the stop date was listed as January 1 2001. If I reset this to today's date it would revert back to the January 1 2001.

Parker

Scott MacVicar 05-29-2002 08:19 AM

Getting it to 2001 is a good trick since there isn't any in the code ;)

You'll need to update all old ads with a time period, setting it today wont work as its based on 12am that day, so by the time you add it, its already happened.


All times are GMT. The time now is 04:48 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02931 seconds
  • Memory Usage 1,824KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete