The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Random banner code - how to use in forum block?
Hi guys, hoping someone can help...
I'm using a random banner code for a few images on my website. Working great within the navbar template with the following code... Code:
$path = '/forum/support/'; $banners = array( array( 'src' => 'image1.png', 'href' => 'http://www.XXXXXXXXXXX.com/'), array( 'src' => 'image2.png', 'href' => 'http://www.XXXXXXXXXX.com'), ); $rnd = rand(0,count($banners)-1); // Pick a random array index. They start with 0, so you have to -1. $href = $banners[$rnd]['href']; // Link HREF $src = $path.$banners[$rnd]['src']; // Image source $randombanner4 = '<a href="'.$href.'" target="_blank"><img border="0" src="'.$src.'" /></a>'; vB_Template::preRegister('navbar', array('randombanner4' => $randombanner4)); My question is this... I would like to use a random banner within a forum block but when I add {vb:raw randombanner4} to the block code, it doesn't work. Anyone know what I need to do? |
#2
|
||||
|
||||
you would need to register it to that template.
for example block_html template Code:
vB_Template::preRegister('block_html', array('randombanner4' => $randombanner4)); |
#3
|
|||
|
|||
Thanks, already tried that but it still didn't work. That said, it was very late last night when I was toying around so I'll give it another go and report back...
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|