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)
-   -   Mist's Random Banner Hack (https://vborg.vbsupport.ru/showthread.php?t=47648)

Dean C 01-11-2003 10:00 PM

Mist's Random Banner Hack
 
Mist's Random Banner Hack

What does this hack do?

This allows you to have a random banner in your header.

Latest Version: 1.0

+++++++++++++++++++++++++++++++++++++++++++
If you install this hack then please click the INSTALL button.
+++++++++++++++++++++++++++++++++++++++++++

Regards

- miSt

N9ne 01-12-2003 03:45 PM

Where's the file? :p

Dean C 01-12-2003 03:48 PM

Hehe this happens everytime i post a hack.

I don't attach the file straight away because i like to add the thread link and install link to the attachment :p

It's in there now :)

- miSt

kikosho 01-12-2003 03:58 PM

screen shot?

Dean C 01-12-2003 04:06 PM

Why do you need to a see a screenshot ^ :)

All this does is generate a random banner :)

- miSt

Chris M 01-12-2003 04:48 PM

Still...

A screenshot would be good;):)

Satan

Dean C 01-12-2003 05:24 PM

I don't see why - all it would be is the the images changing :p

- miSt

N9ne 01-12-2003 08:10 PM

Just post a screenshot will ya! So we know where it goes and how it looks etc...

Link14716 01-13-2003 12:49 AM

[high]* Link14716 runs to help out Mist.
[/high]

Hard to make a screenshot, when it'd just show images of your choosing, and a screenshot won't change everytime you click it, so :p.

;)

I might install this one :)

mx3 01-13-2003 02:21 AM

how about demo, instead of screenshot?

Dean C 01-13-2003 03:22 PM

Hmmm well if someone installs this can they link me and i'll put it in their post (obviously with their permission :p)

- miSt

DrkFusion 01-13-2003 07:06 PM

I would install this, but the fact that it is manually edited (to change banners and stuff) that is the con in my view of this hack, the rest looks good.

Floris 01-14-2003 06:38 PM

PPN made an advert manager .. isn't this the same?

setsykid 01-15-2003 03:17 AM

Hello, I'd like to ask where I can put the url for the banners?
I know I can put more banners creating my own variable, they are just images but the url for them?

thx

NanoEntity 01-15-2003 06:59 AM

nice one Mist!

Mist! I would just forget about global.php, why not just insert this code to the phpinclude, it will be easy to mod if you need to add a new banner.

Also why list them as
$banner[1]="banner1.gif";
$banner[2]="newthread.gif";

Why not make an Array.
$banners=array('banner1', 'banner2');

Here is a simple way to do it, only takes 3 lines
PHP Code:

//?hololith.com(NanoEntity)
$banners=array('banner1''banner2'); //images names
$shuffle=$banners[rand(0,count($banners)-1)]; //shuffle images 
$adbanner="<img src=\"https://vborg.vbsupport.ru/greentek/adbanners/$shuffle.gif\" border=\"0\" alt=\"\">\n"//images output
//END ?hololith.com(NanoEntity) 

Was that easy :)

DEMO:
http://artwork.hololith.com/sigs.php - random
http://artwork.hololith.com/sigs.php?show=draco v1 - static
http://artwork.hololith.com/sigs.php?show=magal v1 - static
http://artwork.hololith.com/sigs.php?show=kinght v1 - static

This generates random signature, same way it would a banner ad, but its more advanced when it comes to code, about 13 lines.

--------------------------
EDIT - Addon

I am geting PMs from people that want diffrent urls to diffrent banners, here is the code

This was tested and it works.
PHP Code:

//?hololith.com(NanoEntity)
$banner1="<a href=\"http://url1\"><img src=\"{ imagesfolder }/adbanners/banner1.gif\" border=\"0\" alt=\"\"></a>";
$banner2="<a href=\"http://url2\"><img src=\"{ imagesfolder }/adbanners/banner2.gif\" border=\"0\" alt=\"\"></a>";

$banners=array($banner1,$banner2); //banner array
$shuffle=$banners[rand(0,count($banners)-1)]; //shuffle banners 
$adbanner="$shuffle\n"//banners output
//END ?hololith.com(NanoEntity) 

Enjoy.

NanoEntity 01-15-2003 07:14 AM

Your joking?

Just put this in <a href=\"http://url\"><img src=...........></a>

And theres your code...

Quote:

Originally posted by setsykid
Hello, I'd like to ask where I can put the url for the banners?
I know I can put more banners creating my own variable, they are just images but the url for them?

thx


Dean C 01-15-2003 03:38 PM

Quote:

Originally posted by xiphoid
PPN made an advert manager .. isn't this the same?
I must say i have lots of plans for this with admin cp intigration soon but again i chose to be a manual edit hack because i'm not confident enough with using mysql to store the banners - i haven't even got to the mysql part in my php book so bare with me for a while hehe :)

Also PPN's hack doesn't currently work :p

- miSt

Dean C 01-15-2003 03:39 PM

Quote:

Originally posted by NanoEntity
nice one Mist!

Mist! I would just forget about global.php, why not just insert this code to the phpinclude, it will be easy to mod if you need to add a new banner.

Also why list them as
$banner[1]="banner1.gif";
$banner[2]="newthread.gif";

Why not make an Array.
$banners=array('banner1', 'banner2');

Here is a simple way to do it, only takes 3 lines
PHP Code:

$banners=array('banner1''banner2'); //images names
$shuffle=$banners[rand(0,count($banners)-1)]; //shuffle images 
$adbanner="<img src=\"https://vborg.vbsupport.ru/greentek/adbanners/$shuffle.gif\" border=\"0\" alt=\"\">\n"//images output 

Was that easy :)

DEMO:
http://artwork.hololith.com/sigs.php - random
http://artwork.hololith.com/sigs.php?show=draco v1 - static
http://artwork.hololith.com/sigs.php?show=magal v1 - static
http://artwork.hololith.com/sigs.php?show=kinght v1 - static

This generates random signature, same way it would a banner ad, but its more advanced when it comes to code, about 13 lines.

The reason i decided to have the variables as an array is to make it easier for newbies to add more banners :) - simple as that !

- miSt

Mike Gaidin 01-18-2003 08:07 AM

Will this only work in the header?

Dean C 01-18-2003 08:26 AM

No you can put the $banner variable in any template you wish :)

- miSt

Mike Gaidin 01-18-2003 11:24 PM

Excellent! Will install!

Dean C 01-19-2003 09:50 AM

Thankyou :)

- miSt

NanoEntity 01-20-2003 11:19 AM

I am geting PMs from people that want diffrent urls to diffrent banners, here is the code

This was tested and it works.
PHP Code:

//?hololith.com(NanoEntity)
$banner1="<a href=\"http://url1\"><img src=\"{ imagesfolder }/adbanners/banner1.gif\" border=\"0\" alt=\"\"></a>";
$banner2="<a href=\"http://url2\"><img src=\"{ imagesfolder }/adbanners/banner2.gif\" border=\"0\" alt=\"\"></a>";

$banners=array($banner1,$banner2); //banner array
$shuffle=$banners[rand(0,count($banners)-1)]; //shuffle banners 
$adbanner="$shuffle\n"//banners output
//END ?hololith.com(NanoEntity) 

Enjoy.

Dean C 01-20-2003 03:44 PM

Instructions on how to add more more banners is outlined in my instructions...

- miSt

Floris 01-20-2003 08:19 PM

Quote:

Originally posted by NanoEntity
I am geting PMs from people that want diffrent urls to diffrent banners, here is the code

This was tested and it works.
PHP Code:

//?hololith.com(NanoEntity)
$banner1="<a href=\"http://url1\"><img src=\"{ imagesfolder }/adbanners/banner1.gif\" border=\"0\" alt=\"\"></a>";
$banner2="<a href=\"http://url2\"><img src=\"{ imagesfolder }/adbanners/banner2.gif\" border=\"0\" alt=\"\"></a>";

$banners=array($banner1,$banner2); //banner array
$shuffle=$banners[rand(0,count($banners)-1)]; //shuffle banners 
$adbanner="$shuffle\n"//banners output
//END ?hololith.com(NanoEntity) 

Enjoy.

They don't rotate :/

NanoEntity 01-21-2003 09:59 AM

it dose rotate, I just checked it, click refresh few times.

Floris 01-21-2003 10:08 AM

Quote:

Originally posted by NanoEntity
it dose rotate, I just checked it, click refresh few times.
Bwah!

I set $banner and ofcourse in your code it is $adbanner :) FIXED :P hehe.

ScottRoberts 02-02-2003 03:38 AM

Quote:

//?hololith.com(NanoEntity)
$banner1="<a href=\"http://url1\"><img src=\"{ imagesfolder }/adbanners/banner1.gif\" border=\"0\" alt=\"\"></a>";
$banner2="<a href=\"http://url2\"><img src=\"{ imagesfolder }/adbanners/banner2.gif\" border=\"0\" alt=\"\"></a>";

$banners=array($banner1,$banner2); //banner array
$shuffle=$banners[rand(0,count($banners)-1)]; //shuffle banners
$adbanner="$shuffle\n"; //banners output
//END ?hololith.com(NanoEntity)
NanoEntity,

I used your script and it worked great. I have about 8 or 9 banner ads running now, and after a few modifications to the header template, I was able to get my header to look just right. Thanks. If anyone wants to see a sample, you can take a look at http://forums.cultfree.org.

Thanks again!

Scott

Dean C 02-02-2003 10:30 AM

Hey nano i just realised what you did. The original intention of this hack was to just rotate images but i'll change the text file to allow url's :)

Regards

- miSt

Chris M 02-02-2003 10:37 AM

PPN's hack may not work, but mine does;):p

Perhaps you could try and make a size limiter bit to the image;)

Satan

Dean C 02-02-2003 01:11 PM

That quite easy just another variable but i plan to have this admin cp intigrated once i reach the mysql part of my book :)

- miSt

mrderanged 02-08-2003 03:01 PM

Hey all,

First of all, thanks for this hack. I have it installed and it's working fine.

I am however wondering, would there be a way to change it so that it rotates the banners after a set time as opposed to each time the page is refreshed. It seems that the randomness keeps pulling up the same banners time after time and it's not an even enough mix......

Thanks in advance...

Scott

Dean C 02-08-2003 03:10 PM

Sorry buddy. My php isn't advanced enough for that. This is the best randomness that i can do :)

- miSt

Koss 02-09-2003 07:30 AM

could you make it do that its not on forumhome?

Dean C 02-09-2003 10:11 AM

This does it in the header and not forumhome...

Just insert the $banner variable in any template to call the random banner :)

- miSt

Koss 02-09-2003 06:40 PM

Quote:

Originally posted by NanoEntity
nice one Mist!

Mist! I would just forget about global.php, why not just insert this code to the phpinclude, it will be easy to mod if you need to add a new banner.

Also why list them as
$banner[1]="banner1.gif";
$banner[2]="newthread.gif";

Why not make an Array.
$banners=array('banner1', 'banner2');

Here is a simple way to do it, only takes 3 lines
PHP Code:

//?hololith.com(NanoEntity)
$banners=array('banner1''banner2'); //images names
$shuffle=$banners[rand(0,count($banners)-1)]; //shuffle images 
$adbanner="<img src=\"https://vborg.vbsupport.ru/greentek/adbanners/$shuffle.gif\" border=\"0\" alt=\"\">\n"//images output
//END ?hololith.com(NanoEntity) 

Was that easy :)

DEMO:
http://artwork.hololith.com/sigs.php - random
http://artwork.hololith.com/sigs.php?show=draco v1 - static
http://artwork.hololith.com/sigs.php?show=magal v1 - static
http://artwork.hololith.com/sigs.php?show=kinght v1 - static

This generates random signature, same way it would a banner ad, but its more advanced when it comes to code, about 13 lines.

--------------------------
EDIT - Addon

I am geting PMs from people that want diffrent urls to diffrent banners, here is the code

This was tested and it works.
PHP Code:

//?hololith.com(NanoEntity)
$banner1="<a href=\"http://url1\"><img src=\"{ imagesfolder }/adbanners/banner1.gif\" border=\"0\" alt=\"\"></a>";
$banner2="<a href=\"http://url2\"><img src=\"{ imagesfolder }/adbanners/banner2.gif\" border=\"0\" alt=\"\"></a>";

$banners=array($banner1,$banner2); //banner array
$shuffle=$banners[rand(0,count($banners)-1)]; //shuffle banners 
$adbanner="$shuffle\n"//banners output
//END ?hololith.com(NanoEntity) 

Enjoy.

NanoEntity, could you please explain how one would add a flash banner (*.swf)

thanks Mist :)

mrderanged 02-10-2003 12:20 PM

Hey All,

My PHP is pretty much nonexistant, but I was wondering if the following is possible:

I'd like to have one banner in the header, and one in the footer. I've done this by putting the "$adbanner" variable in the spot where I want them. My problem is that they are both showing the same banner and I would like to have them showing different banners. If I were to add the following line to the end of this hack:

PHP Code:

//?hololith.com(NanoEntity)
$banner1="<a href=\"http://url1\"><img src=\"{ imagesfolder }/adbanners/banner1.gif\" border=\"0\" alt=\"\"></a>";
$banner2="<a href=\"http://url2\"><img src=\"{ imagesfolder }/adbanners/banner2.gif\" border=\"0\" alt=\"\"></a>";

$banners=array($banner1,$banner2); //banner array
$shuffle=$banners[rand(0,count($banners)-1)]; //shuffle banners 
$adbanner="$shuffle\n"//banners output
$adbanner1="$shuffle\n"//banners output 

and add "$adbanner1" to my footer instead of "$adbanner" would this give me a different banner than the one in the header?

Sorry for the newbie question....

Scott

Dean C 02-10-2003 03:41 PM

Simple just duplicate the code like so and use this instead:

PHP Code:

///////// Start Random Banner Hack for header /////////////

//Define Variables //
$bannerh[1]="banner1.gif";
$bannerh[2]="newthread.gif";
$numbanners count($bannerh);

// Generate ranodomness
$num rand(1,$numbanners);

//output banner
$bannerh "<img src=\"{imagesfolder}/bannerh$num\" border=\"0\" alt=\"\" />";

////////// End Random banner Hack for header///////////////

///////// Start Random Banner Hack for footer /////////////

//Define Variables //
$bannerf[1]="banner1.gif";
$bannerf[2]="newthread.gif";
$numbanners count($bannerf);

// Generate ranodomness
$num rand(1,$numbanners);

//output banner
$bannerf "<img src=\"{imagesfolder}/bannerf$num\" border=\"0\" alt=\"\" />";

////////// End Random banner Hack for footer/////////////// 

Use $bannerh for your header and $bannerf for your footer :)

Regards

- miSt

Koss 02-11-2003 04:09 AM

alright I got the code for the flash banners....but when I put the code for the flash banner, like this

Code:

$bannerh[2]="<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" ID=popup_06 WIDTH=250 HEIGHT=250>
<PARAM NAME=movie VALUE="http://www.yourdomain.com/banner.swf?url=[AffiliateWizTargetURL]http://www.yourdomain.com"> <PARAM NAME=menu VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF>
 <EMBED src="http://www.yourdomain.com/banner.swf?url=[AffiliateWizTargetURL]http://www.yourdomain.com" menu=false quality=high bgcolor=#FFFFFF swLiveConnect=FALSE WIDTH=250 HEIGHT=250 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</EMBED>
</OBJECT>";

it doesnt seem to work
someone please help :(

Dean C 02-11-2003 03:29 PM

Any double quotes in php have to have a " \ " before them...

- miSt


All times are GMT. The time now is 04:43 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.01376 seconds
  • Memory Usage 1,868KB
  • 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
  • (1)bbcode_code_printable
  • (9)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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