vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=155)
-   -   Random Logo in Header (https://vborg.vbsupport.ru/showthread.php?t=99402)

rareclownfish 04-11-2006 02:19 AM

Perfect! :)

hotwheels 04-17-2006 12:47 AM

very nice

is mise 05-13-2006 02:07 PM

Quote:

Originally Posted by spongebobrox128
*Sighs*, why cannot anyone write there own scripts (not vB hacks (leave that to coders who are expericend with vB), but JS is pretty simple)
Random Image Scripts with links or with out are really simple. This will work for links (put this in top of headinclude)
Code:

<script type='text/javascript'> function randImage() {  images = new array();  links = new array();  images[0] = 'http://mysite.com/mybanner.gif';  links[0] = 'http://mysite.com/service/';  images[1] = 'http://mysite.com/cool.gif';  links[1] = 'http://mysite.com/cool.html';  var randIndex = Math.round(Math.random()*(images.length-1));  document.write("<a href='" + links[randIndex] + "'><img src='" + links[randIndex] + "'></a>");  return true; } </script>
In Header Under "<!-- logo -->" put:
Code:

<script type='text/javascript'> randImage(); </script>
images[x] and links[x] are matching, so if you have images[1] configured to a banner for your hosting services, and you have a specific page for that banner, links[1] would be THE FULL URL to that page.And I just wrote this, and I didn't test it, so there may be a few errors. Tell me if it doesn't work.


A few typos. This worked, though:

Code:

function randImage() {
  var images = new Array();
  var links = new Array();
  images[0] = 'http://www.mysite.com/graphics/23.jpg';
  links[0] = 'http://www.appleinsider.com';
  images[1] = 'http://www.mysite.com/graphics/20.jpg';
  links[1] = 'http://macrumors.com';
  var randIndex = Math.round(Math.random()*(images.length-1));
  document.write('<a href="' + links[randIndex] + '"><img src="' + images[randIndex] + '" border="0"></a>');
  return true;
 }


defcon_420 05-18-2006 02:22 PM

Quote:

Originally Posted by attroll
This using this code. You can add as many rotating banners that you want.


Code:

<!-- Begin rotating ad code -->
<
script language="Javascript"
><!--
function
image
() {
};
image = new image
();
number = 0
;
// imageArray
image[number++] =
"<a href='http://www.yoursite.net/forum/payments.php'><img src='http://www.yoursite.net/forum/sponsors/donatebanner.gif' border='0'></a>"
image[number++] =
"<a href='http://www.hikersupply.com'><img src='http://www.yoursite.net/forum/sponsors/hikersupply.gif' border='0'></a>"
image[number++] =
"<a href='http://www.modelt.net'><img src='http://www.yoursite.net/forum/sponsors/modeltbanner.gif' border='0'></a>"
image[number++] =
"<a href='http://appalachiantrailservices.com/'><img src='http://www.yoursite.net/forum/sponsors/atservicesbanner.gif' border='0'></a>"
image[number++] =
"<a href='http://www.thepacka.com/'><img src='http://www.yoursite.net/forum/sponsors/cedartreebanner.gif' border='0'></a>"
// Carry on adding images - as many as you want
increment = Math.floor(Math.random() * number
);
document.write(image[increment
]);
//-->
</script>
<!-- End rotating ad code -->


Nice simple and it works :) thanks!

Ahsin1 05-18-2006 08:04 PM

cool nice modification... thanx...

installed @ www.DesiOutlaws.net

xtreme2 05-22-2006 11:56 PM

pretty cool... all I am wondering is how would you get it to replace the forum logo?

http://forums.probe-enthusiast.com/

that is my forum... since my forum logo is routed into the heading, where would I put it? I got lazy and instead of changing the coding for my forum banner to be displayed, I just changed the filename so that it replaced the original logo.

Let me know...

Binoy 05-23-2006 02:56 PM

Nice mod...what if i want to have random lgo in my header ?

can someone help me in this ?

legion_diabolic 05-23-2006 06:50 PM

Nothing in the vbull documentation, nothing in search, certainly nothing in the admincp under vbull options or any other logical category I can think of. The only reference to javascript whatsoever has to do with external data sydication ie. including vbull data as html in an external document.

Daniel 05-29-2006 05:22 PM

Quote:

Originally Posted by xtreme2
pretty cool... all I am wondering is how would you get it to replace the forum logo?
http://forums.probe-enthusiast.com/

that is my forum... since my forum logo is routed into the heading, where would I put it? I got lazy and instead of changing the coding for my forum banner to be displayed, I just changed the filename so that it replaced the original logo.

Let me know...

Quote:

Originally Posted by Binoy
Nice mod...what if i want to have random lgo in my header ?

can someone help me in this ?

Find in header
Code:

<!-- logo -->
<a name="top"></a>
<table border="0" width="$stylevar[outertablewidth]" cellpadding="0" cellspacing="0" align="center">
<tr>
        <td align="$stylevar[left]"><a href="$vboptions[forumhome].php$session[sessionurl_q]"><img src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" /></a></td>
        <td align="$stylevar[right]">
                &nbsp;
        </td>
</tr>
</table>
<!-- /logo -->

and replace with
Code:

<SCRIPT LANGUAGE="JavaScript">
 
<!-- Begin Random Logo In Header Script
 
var theImages = new Array() // do not change this
 
<!-- Edit the url images to match yours
theImages[0] = 'http://www.yoursite.com/forum/images/banner1.gif'
theImages[1] = 'http://www.yoursite.com/forum/images/banner2.gif'
 
 
 
var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<div align="center"><a href="index.php"><img src="'+theImages[whichImage]+'" border="0" alt="$vboptions[bbtitle]" /></a></div>');
}
 
// End -->
</script>

<!-- output logo -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
showImage();
<!-- end -->
</script>

change the image paths accordingly.

Daniel 05-29-2006 05:23 PM

Quote:

Originally Posted by legion_diabolic
Nothing in the vbull documentation, nothing in search, certainly nothing in the admincp under vbull options or any other logical category I can think of. The only reference to javascript whatsoever has to do with external data sydication ie. including vbull data as html in an external document.

The end user must have javascript enabled.

bada_bing 05-29-2006 06:17 PM

Nice reserved for later use

Wabuf 06-02-2006 12:37 PM

This is perfect! Thanks

GrandAmGuru 09-20-2006 04:13 PM

I'm using the following version of the code

PHP Code:

<script language="Javascript"><!-- 
function 
image() { 
}; 
image = new image(); 
number 0
// imageArray 
image[number++] = "<a href='http://www.domain.net'><img src='http://www.domain.net/picture1.gif' border='0'></a>"
image[number++] = "<a href='http://www.domain.net'><img src='http://www.domain.net/picture2.gif' border='0'></a>"
image[number++] = "<a href='http://www.domain.net'><img src='http://www.domain.net/picture3.jpg' border='0'></a>"
image[number++] = "<a href='http://www.domain.net'><img src='http://www.domain.net/picture4.gif' border='0'></a>"
image[number++] = "<a href='http://www.domain.net'><img src='http://www.domain.net/picture4.jpg' border='0'></a>"
 
// Carry on adding images - as many as you want
increment Math.floor(Math.random() * number); 
document.write(image[increment]); 
//-->
</script

and I can't for the life of me get the right code to center the image. I've tried all sorts of things in the document.write(image[increment]); line. Help!

nevermind. found it.

document.write("<center>",image[increment]);

attroll 09-20-2006 04:49 PM

Quote:

Originally Posted by GrandAmGuru
I'm using the following version of the code

PHP Code:

<script language="Javascript"><!-- 
function 
image() { 
}; 
image = new image(); 
number 0
// imageArray 
image[number++] = "<a href='http://www.domain.net'><img src='http://www.domain.net/picture1.gif' border='0'></a>"
image[number++] = "<a href='http://www.domain.net'><img src='http://www.domain.net/picture2.gif' border='0'></a>"
image[number++] = "<a href='http://www.domain.net'><img src='http://www.domain.net/picture3.jpg' border='0'></a>"
image[number++] = "<a href='http://www.domain.net'><img src='http://www.domain.net/picture4.gif' border='0'></a>"
image[number++] = "<a href='http://www.domain.net'><img src='http://www.domain.net/picture4.jpg' border='0'></a>"
 
// Carry on adding images - as many as you want
increment Math.floor(Math.random() * number); 
document.write(image[increment]); 
//-->
</script

and I can't for the life of me get the right code to center the image. I've tried all sorts of things in the document.write(image[increment]); line. Help!

nevermind. found it.

document.write("<center>",image[increment]);

It looks like your using the code form this hack, https://vborg.vbsupport.ru/showthread.php?t=106682

Have you tried putting a <center> in front and a <center> at the end of the script?

SFertitta72 04-07-2008 04:20 PM

This is a nice little hack.

However, how do I get the images to stretch across the entire length of the page? Is there a way to make this have a separate left image (that doesnt change) and a right one that does?

Thanks in advance.


All times are GMT. The time now is 07:41 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.01321 seconds
  • Memory Usage 1,817KB
  • 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
  • (6)bbcode_code_printable
  • (2)bbcode_php_printable
  • (6)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
  • (15)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