The Arcive of vBulletin Modifications Site. | 
    |
| 
		 
			 
			#1  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
			
			 
			
			I found some code on another forum that's supposed to show a random banner within vbulletin. People posting in the thread got it to work, but I'm stuggling. If someone wouldn't mind taking a look and telling me what I'm doing wrong, I'd greatly appreciate it. 
		
		
		
		
		
		
		
		
	
	I created a new plugin, with the hook location of "global_start" with this code: Code: 
	$banner[1] = "<center><a href=\"http://advertiser-edit.com/?utm_source=website.org&utm_medium=banner&utm_campaign=websiteleaderboard\"><img src=\"http://www.website.org/leaderboard_books_design.jpg\"></a></center>"; $banner[2] = "<center> <script type=\"text/javascript\"><!-- google_ad_client = \"ca-pub-numbersremoved\"; google_ad_slot = \"4591232780\"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"> </script></center>"; $rotator = rand(1, 2); $bannerrotator = $banner[$rotator]; Thanks guys.  | 
| 
		 
			 
			#2  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
			
			 
			
			The problem is that that was intended for vb3.  But it should work in vb4 with a few changes. First, use hook parse_templates.  Next, add the following line to the end of the plugin code (for the navbar template): 
		
		
		
		
		
		
		
		
	
	Code: 
	vB_Template::preRegister('navbar', array('bannerrotator' => $bannerrotator));
Then in the navbar template, use {vb:raw bannerrotator}.  | 
| 
		 
			 
			#3  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
			
			 
			
			Thank you very much for the help. Got it working.  
		
		
		
		
		
		
		
		
	
	 
		 | 
| 
		 
			 
			#4  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
			
			 
			
			I am having the same trouble. Total noob question... 
		
		
		
		
		
		
		
		
	
	When you say the navbar template, where do I find this to insert the {vb:raw bannerrotator}. ?  | 
| 
		 
			 
			#5  
			
			
			
			
			
		 
		
	 | 
||||
		
		
  | 
||||
| 
		
	
		
		
			
			 
			
			Admincp > Styles & Templates > Style Manager > find style > Edit Templates
		 
		
		
		
		
		
		
		
		
	
	 | 
| 
		 
			 
			#6  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
			
			 
			
			Thanks!
		 
		
		
		
		
		
		
		
		
	
	 | 
| 
		 
			 
			#7  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
			
			 
			
			Okay, I have yet to get this to work properly. I posted this code: 
		
		
		
		
		
		
		
		
	
	$banner[1] = "<a href="http://bham-jk.com/showthread.php?1015-Meet-N-Mod-Party" target="_blank"><img src="http://i93.photobucket.com/albums/l72/JOHNNYP4409/MeetNModparty_zps9e808cc0.jpg" border="0" alt="MeetnModParty"/></a>"; $banner[2] = "<a href="http://www.tntaccessoriesnservicecenter.com/" target="_blank"><img src="http://i93.photobucket.com/albums/l72/JOHNNYP4409/TNTBannerBlack.png" border="0" alt="TNTaccessories"></a>>"; $rotator = rand(1, 2); $bannerrotator = $banner[$rotator]; vB_Template:: preRegister('navbar', array('bannerrotator' => $bannerrotator)); Then put this in the "ad_global_below_navbar" template: {vb:raw bannerrotator} Then I get this error: Parse error: syntax error, unexpected T_STRING in /home/bhamjk/public_html/includes/class_bootstrap.php(430) : eval()'d code on line 1 So, what have I done wrong?  | 
| 
		 
			 
			#8  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
			
			 
			
			dam just posted about the double >> but was beat to it
		 
		
		
		
		
		
		
		
		
	
	 | 
| 
		 
			 
			#9  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
			
			 
			
			The problem is that you've put double quotes around strings that contained double quotes, so they're mismatched. If you use single quotes instead it should work, like: 
		
		
		
		
		
		
		
		
	
	Code: 
	$banner[1] = '<a href="http://bham-jk.com/showthread.php?1015-Meet-N-Mod-Party" target="_blank"><img src="http://i93.photobucket.com/albums/l72/JOHNNYP4409/MeetNModparty_zps9e808cc0.jpg" border="0" alt="MeetnModParty"/></a>';
$banner[2] = '<a href="http://www.tntaccessoriesnservicecenter.com/" target="_blank"><img src="http://i93.photobucket.com/albums/l72/JOHNNYP4409/TNTBannerBlack.png" border="0" alt="TNTaccessories"></a>>';
$rotator = rand(1, 2);
$bannerrotator = $banner[$rotator];
vB_Template:: preRegister('navbar', array('bannerrotator' => $bannerrotator));
Also I noticed that the $banner[2] string has >> at the end, I don't know if that's a typo or not.  | 
| 
		 
			 
			#10  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
			
			 
			
			Thanks guys. I got those fixed. Not showing any errors now, but the banner still doesn't show up. 
		
		
		
		
		
		
		
		
	
	Using VB4 if that helps  | 
![]()  | 
	
	
		
		
  | 
	
		
  | 
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
						
  | 
				|
  More Information | 
				|
| 
						 Template Usage: 
						
 Phrase Groups Available: 
						
  | 
					
						 Included Files: 
						
 Hooks Called: 
						
  |