vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How do I add a second simple rotating banner? (https://vborg.vbsupport.ru/showthread.php?t=174879)

Fredrik_Arvid 04-02-2008 09:31 AM

How do I add a second simple rotating banner?
 
Hello,

I use this script for a simple rotating banner in the header:
http://www.vbulletin.com/forum/showthread.php?t=170826

And it works fine.

Now I am trying to put a second rotating banner after the firts post in every thread.
But it does not work. Nothing shows up.

I am replacing all instances of $random_banner with $random_banner2:

Code:

$random_number = rand(1, 4);

$random_banner2[1] = '<a href="http://www.mysite.com"><img src="http://www.mysite.com/banner1.gif" alt="" border="0" /></a>';
$random_banner2[2] = '<a href="http://www.mysite.com"><img src="http://www.mysite.com/banner2.gif" alt="" border="0" /></a>';
$random_banner2[3] = '<a href="http://www.mysite.com"><img src="http://www.mysite.com/banner3.gif" alt="" border="0" /></a>';
$random_banner2[4] = '<a href="http://www.mysite.com"><img src="http://www.mysite.com/banner4.gif" alt="" border="0" /></a>';

And I use this code to displaying the random banner:

Code:

$random_banner2[$random_number]
But it doesn?t work! It?s just empty. Am I doing something wrong?

Please help me!

Regards,
Fredrik_Arvid

Dismounted 04-02-2008 11:48 AM

Try this:
Code:

$random_number2 = rand(1, 4);

$random_banner2[1] = '<a href="http://www.mysite.com"><img src="http://www.mysite.com/banner1.gif" alt="" border="0" /></a>';
$random_banner2[2] = '<a href="http://www.mysite.com"><img src="http://www.mysite.com/banner2.gif" alt="" border="0" /></a>';
$random_banner2[3] = '<a href="http://www.mysite.com"><img src="http://www.mysite.com/banner3.gif" alt="" border="0" /></a>';
$random_banner2[4] = '<a href="http://www.mysite.com"><img src="http://www.mysite.com/banner4.gif" alt="" border="0" /></a>';

Then this to display:
Code:

$random_banner2[$random_number2]
If that does not work, where are you putting each of the code blocks?

Fredrik_Arvid 04-02-2008 01:36 PM

Hello Dismounted,
I tried your solution but that did not work.

I am putting the code block in
Admin CP -> Styles & Templates -> Style Manager -> ? ? -> Postbit Templates -> postbit
at the very bottom:

Code:

<!-- / post $post[postid] popup menu -->
<if condition="$post[postcount] == 1 AND $GLOBALS[threadinfo][replycount] >= 2">

<div style="padding: $stylevar[cellpadding]px 0px 0px 0px">

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="thead" align="left">Annons</td>
</tr>
<tr>
        <td class="alt1" align="center">
                $random_banner[$random_number]

        </td>
</tr>
</table>
</div>
</if>

I am using this thing described at vbulletin.com: How To Show A Banner After The First Post In A Thread

(I have got the first simple banner rotator - the one that works fine - in the footer template.)

Dismounted 04-03-2008 05:34 AM

Where are you putting the code block (PHP code)?

Fredrik_Arvid 04-03-2008 07:58 AM

I am putting it as a new plugin in: Plugin & Products System

Dismounted 04-03-2008 08:24 AM

At which hook?

Fredrik_Arvid 04-03-2008 08:42 AM

Hook location: parse_templates

Fredrik_Arvid 04-05-2008 05:13 AM

Is it OK to put it in the pare_templates?

Dismounted 04-05-2008 09:42 AM

Try changing to hook location to global_start.

Fredrik_Arvid 04-07-2008 02:40 PM

Quote:

Originally Posted by Dismounted (Post 1483439)
Try changing to hook location to global_start.

It didn`t work.


All times are GMT. The time now is 07:07 AM.

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.02714 seconds
  • Memory Usage 1,738KB
  • 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
  • (5)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete