vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Getting PHP to load in side bar? (https://vborg.vbsupport.ru/showthread.php?t=161017)

WoodiE 10-24-2007 02:55 PM

Getting PHP to load in side bar?
 
I have the following PHP code:

Code:

<?php
$image[0]['src'] = '/images/your-ad-here.gif';
$image[0]['link'] = 'http://www.domain.com';
$image[0]['title'] = 'Your Ad Here';
$image[0]['alt'] = 'Your Ad Here';
$image[1]['src'] = '/images/advertisement2.gif';
$image[1]['link'] = 'http://www.domain2.com';
$image[1]['title'] = 'Company';
$image[1]['alt'] = 'Company';

shuffle( $image );
$html = '';
foreach( $image as $arr )
{
    $html .= '<a href="' . $arr['link'] . '" title="' . $arr['title'] . '" rel="nofollow"><img src="' . $arr['src'] . '" alt="' . $arr['alt'] . '"></a>';
}

echo $html;

?>

The code works exactly how I want it to in a PHP page or a wordpress page, however I can't get this to work in vBulletin or in a vbulletin side menu.

How would I go about doing this?

ragtek 10-24-2007 03:18 PM

you put this code into a plugin with hook global_start for example but without echo $html;

then you can put $html into the the template where it should be shown

Opserty 10-24-2007 03:21 PM

I would use another variable name instead of $html since vB might use that somewhere. (I know they use $HTML in the UserCP so you could get conflicts. Go with something more descriptive but still short. ;)

WoodiE 10-24-2007 03:25 PM

ragtek,

Worked just like a dream - thanks so much!

--------------- Added [DATE]1193243392[/DATE] at [TIME]1193243392[/TIME] ---------------

Opserty,

I will change the variable as well then!


All times are GMT. The time now is 03:36 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.00981 seconds
  • Memory Usage 1,711KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete