The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Getting simple php code to show in sidebar
Hi guys,
Been pulling my hair out trying to get my banner code to work in the sidebar. Any ideas how to make this code work? I've tried everything, seems like it should be very easy. <?php include_once('scripts/125_adverts.php'); echo "<div align='center'>$bannerAd</div>"; ?> Thanks! |
#2
|
||||
|
||||
What's the code in the file, scripts/125_adverts.php
|
#3
|
|||
|
|||
Ok it's long...
Code:
<?php $bannerCounter= 1; $bannerCode[$bannerCounter] = "<A HREF=\"http://www.vanhalenstore.com/page/VH/CTGY/CF\" target=\"_blank\"> <IMG SRC=\"/adimages/6-2013/CTGY:CF.jpg\" BORDER=\"0\" HEIGHT=\"402\" WIDTH=\"160\" alt=\"VanHalenStore.com\"></A>"; $bannerCounter++; $bannerCode[$bannerCounter] = "<A HREF=\"http://www.vanhalenstore.com/page/VH/CTGY/shirts_kids\" target=\"_blank\"> <IMG SRC=\"/adimages/6-2013/CTGY:shirts_kids_ANOTHER.jpg\" BORDER=\"0\" HEIGHT=\"390\" WIDTH=\"160\" alt=\"VanHalenStore.com\"></A>"; $bannerCounter++; $bannerCode[$bannerCounter] = "<A HREF=\"http://www.vanhalenstore.com/page/VH/CTGY/shirts_kids\" target=\"_blank\"> <IMG SRC=\"/adimages/6-2013/CTGY:shirts_kids.jpg\" BORDER=\"0\" HEIGHT=\"329\" WIDTH=\"160\" alt=\"VanHalenStore.com\"></A>"; $bannerCounter++; $bannerCode[$bannerCounter] = "<A HREF=\"http://www.vanhalenstore.com/page/VH/PROD/PROD/ACC05\" target=\"_blank\"> <IMG SRC=\"/adimages/6-2013/PROD:ACC05.jpg\" BORDER=\"0\" HEIGHT=\"236\" WIDTH=\"160\" alt=\"VanHalenStore.com\"></A>"; $bannerCounter++; $bannerCode[$bannerCounter] = "<A HREF=\"http://www.vanhalenstore.com/page/VH/PROD/EVHA05\" target=\"_blank\"> <IMG SRC=\"/adimages/6-2013/PROD:EVHA05.jpg\" BORDER=\"0\" HEIGHT=\"240\" WIDTH=\"160\" alt=\"VanHalenStore.com\"></A>"; $bannerCounter++; $bannerCode[$bannerCounter] = "<A HREF=\"http://www.vanhalenstore.com/page/VH/PROD/S91\" target=\"_blank\"> <IMG SRC=\"/adimages/6-2013/PROD:S91.jpg\" BORDER=\"0\" HEIGHT=\"387\" WIDTH=\"160\" alt=\"VanHalenStore.com\"></A>"; $bannerCounter++; $bannerCode[$bannerCounter] = "<A HREF=\"http://www.vanhalenstore.com/page/VH/PROD/S164\" target=\"_blank\"> <IMG SRC=\"/adimages/6-2013/PROD:S164.jpg\" BORDER=\"0\" HEIGHT=\"265\" WIDTH=\"160\" alt=\"VanHalenStore.com\"></A>"; $bannerCounter++; $bannerCode[$bannerCounter] = "<A HREF=\"http://www.vanhalenstore.com/page/VH/PROD/S179\" target=\"_blank\"> <IMG SRC=\"/adimages/6-2013/PROD:S179.jpg\" BORDER=\"0\" HEIGHT=\"253\" WIDTH=\"160\" alt=\"VanHalenStore.com\"></A>"; $bannerCounter++; $bannerCode[$bannerCounter] = "<A HREF=\"http://www.vanhalenstore.com/page/VH/PROD/S216\" target=\"_blank\"> <IMG SRC=\"/adimages/6-2013/PROD:S216.jpg\" BORDER=\"0\" HEIGHT=\"263\" WIDTH=\"160\" alt=\"VanHalenStore.com\"></A>"; $bannerCounter++; $bannerCode[$bannerCounter] = "<A HREF=\"http://www.vanhalenstore.com/page/VH/PROD/S311\" target=\"_blank\"> <IMG SRC=\"/adimages/6-2013/PROD:S311.jpg\" BORDER=\"0\" HEIGHT=\"256\" WIDTH=\"160\" alt=\"VanHalenStore.com\"></A>"; $bannerCounter++; $bannerCode[$bannerCounter] = "<A HREF=\"http://www.vanhalenstore.com/page/VH/PROD/S312\" target=\"_blank\"> <IMG SRC=\"/adimages/6-2013/PROD:S312.jpg\" BORDER=\"0\" HEIGHT=\"342\" WIDTH=\"160\" alt=\"VanHalenStore.com\"></A>"; $bannerCounter++; $bannerAdTotals = $bannerCounter - 1; if($bannerAdTotals>1) { mt_srand((double)microtime() * 1234567); $bannerPicked = mt_rand(1, $bannerAdTotals); } else { $bannerPicked = 1; } $bannerAd = $bannerCode[$bannerPicked]; ?> |
#4
|
|||
|
|||
Shoot nobody has any ideas? This is so frustrating, and I know it has to be easy.
|
#5
|
|||
|
|||
Do you have a template created for the sidebar block?
Also, you must return your value for $bannerAd, not just set it. I'd suggest looking at a couple of mods that include a sidebar block for more detailed examples. |
Благодарность от: | ||
Max Taxable |
#6
|
||||
|
||||
Actually he wouldn't be able to return it as none of the code in the php file is in a function, so he's using it correctly as is.
Which hook are you using to execute that code? |
#7
|
|||
|
|||
I'm not using any hook to run it right now. I'm upgrading from my 3.8 board, so it's way different. Right now I just call my site's header and left column stuff with a separate .php page and I put that code inside there and it works great. Obviously 4.2.2 is WAY different, so just not sure where to begin to get it in the sidebar.
|
#8
|
|||
|
|||
Quote:
|
#9
|
|||
|
|||
Which is what I tried to do and it just won't parse anything.
|
#10
|
|||
|
|||
Download my raffle mod...
https://vborg.vbsupport.ru/showthrea...hlight=raffles Install it and look at the raffle_sideblock template. And look at the 'Active Raffles' block code for an example of how to return data to the sideblock template. (that is what is shown in the picture above) |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|