valdet
05-22-2013, 08:28 PM
Hi all,
I'm trying to display multiple sponsor banners for a single forum on a random basis inside forumhome_forumbit_level2_post template
Here's what I done so far.
I created a simple rotator plugin on parse_templates hook
$graphics = mt_rand(1, 4);
$banner[1] = '<a href="http://www.sponsorbanner1.com/"><img src="http://www.mysite.com/images/banner-1.gif></a>';
$banner[2] = '<a href="http://www.sponsorbanner2.com/"><img src="http://www.mysite.com/images/banner-2.gif></a>';
$banner[3] = '<a href="http://www.sponsorbanner3.com/"><img src="http://www.mysite.com/images/banner-3.gif></a>';
$banner[4] = '<a href="http://www.sponsorbanner4.com/"><img src="http://www.mysite.com/images/banner-4.gif></a>';
When I place $banner[$graphics] inside forumhome_forumbit_level2_post it does not show anything.
The variable $banner[$graphics] works on other templates, such as navbar, header, etc...
I also tried by creating a plugin which includes an external php file.
ob_start();
include('home/xyz/public_html/myforum/banners.php');
$includedphp = ob_get_contents();
ob_end_clean();
and here's banners.php file contents
<?php
$graphics = mt_rand(1,8);
$banner_1 = '<a href="http://www.sponsorbanner1.com/"><img src="http://www.mysite.com/images/banner-1.gif></a>';
$banner_2 = '<a href="http://www.sponsorbanner2.com/"><img src="http://www.mysite.com/images/banner-2.gif></a>';
$banner_3 = '<a href="http://www.sponsorbanner3.com/"><img src="http://www.mysite.com/images/banner-3.gif></a>';
$banner_4 = '<a href="http://www.sponsorbanner4.com/"><img src="http://www.mysite.com/images/banner-4.gif></a>';
echo ${banner_.$graphics};
?>
I added the $includephp variable on global_start, parse_templates, and many other hook locations and none were displaying the banners
I even went further by adding custom hooks per Paul's article (https://vborg.vbsupport.ru/showthread.php?t=83390).
I then added $template_hook[myhook_1] inside forumhome_forumbit_level2_post template and tried both of above plugins to be loaded from myhook_1 location. None of these cases worked.
I am a bit puzzled how to make this work, because when you add either of variables $banner[$graphics] or $includephp they show up just as expected, meaning the plugin code is correct.
However on this particular template it does not show.
Can someone please help me to figure this one out. What am I missing ?
Thanks,
Val.
I'm trying to display multiple sponsor banners for a single forum on a random basis inside forumhome_forumbit_level2_post template
Here's what I done so far.
I created a simple rotator plugin on parse_templates hook
$graphics = mt_rand(1, 4);
$banner[1] = '<a href="http://www.sponsorbanner1.com/"><img src="http://www.mysite.com/images/banner-1.gif></a>';
$banner[2] = '<a href="http://www.sponsorbanner2.com/"><img src="http://www.mysite.com/images/banner-2.gif></a>';
$banner[3] = '<a href="http://www.sponsorbanner3.com/"><img src="http://www.mysite.com/images/banner-3.gif></a>';
$banner[4] = '<a href="http://www.sponsorbanner4.com/"><img src="http://www.mysite.com/images/banner-4.gif></a>';
When I place $banner[$graphics] inside forumhome_forumbit_level2_post it does not show anything.
The variable $banner[$graphics] works on other templates, such as navbar, header, etc...
I also tried by creating a plugin which includes an external php file.
ob_start();
include('home/xyz/public_html/myforum/banners.php');
$includedphp = ob_get_contents();
ob_end_clean();
and here's banners.php file contents
<?php
$graphics = mt_rand(1,8);
$banner_1 = '<a href="http://www.sponsorbanner1.com/"><img src="http://www.mysite.com/images/banner-1.gif></a>';
$banner_2 = '<a href="http://www.sponsorbanner2.com/"><img src="http://www.mysite.com/images/banner-2.gif></a>';
$banner_3 = '<a href="http://www.sponsorbanner3.com/"><img src="http://www.mysite.com/images/banner-3.gif></a>';
$banner_4 = '<a href="http://www.sponsorbanner4.com/"><img src="http://www.mysite.com/images/banner-4.gif></a>';
echo ${banner_.$graphics};
?>
I added the $includephp variable on global_start, parse_templates, and many other hook locations and none were displaying the banners
I even went further by adding custom hooks per Paul's article (https://vborg.vbsupport.ru/showthread.php?t=83390).
I then added $template_hook[myhook_1] inside forumhome_forumbit_level2_post template and tried both of above plugins to be loaded from myhook_1 location. None of these cases worked.
I am a bit puzzled how to make this work, because when you add either of variables $banner[$graphics] or $includephp they show up just as expected, meaning the plugin code is correct.
However on this particular template it does not show.
Can someone please help me to figure this one out. What am I missing ?
Thanks,
Val.