vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   css code to show random pictures (https://vborg.vbsupport.ru/showthread.php?t=234392)

glassjoe 01-28-2010 01:42 PM

css code to show random pictures
 
I have the RedTyger mod set up and its working, I am placing ads down the right side of my forum
My forum is www.runnersrule.com
my goal is to get it to look like www.teamspeed.com or www.l4p.com
Im torn on the size of my header, its huge, but so are those other sites headers and they seem to do pretty well, i know other factors are involved.

anyway, im pulling my hair out with trying to do something pretty basic.

when i have 10-15 ads, i a column, down the right side of my site, is there some code i can use to get them to appear randomly so the same ads arent always on the top??
they are just simiple jpg with links,
any help would be greatly appreciated.

thank you.

Marco van Herwaarden 01-28-2010 02:32 PM

You can best ask this in the thread of the modification you are using.

glassjoe 01-28-2010 03:18 PM

its just the standard to code to jpg's to appear randomly, i have them all there i cant get them to appear randomly on page refresh, i know its really basic, but i can figure it out.

having a tough time with this one

slobra 01-28-2010 03:47 PM

1) Create a PHP file called "sponsors.php" with the following code and upload it to domain.com/forums. You can add as many links/images to the array as you want, just keep the same format:

Code:

<?php
define('LINK_URL', 0);
define('IMAGE_URL', 1);

$images = array(
  array(LINK_URL => 'http://www.example.com', IMAGE_URL => 'http://domain.com/forums/images/ads/example_small.jpg'),
  array(LINK_URL => 'http://www.example2.com', IMAGE_URL => 'http://domain.com/forums/images/ads/example_small2.jpg'),
  array(LINK_URL => 'http://www.example3.com', IMAGE_URL => 'http://domain.com/forums/images/ads/example_small3.jpg'),
);

shuffle($images);

foreach($images as $image) {
  echo '<a href="' . $image[LINK_URL] . '"><img src="' . $image[IMAGE_URL] . '" border="0" /></a><p>';
}
?>


Admin CP > Plugins and Products > Add New Plugin

2) Create a new plugin with this info:

- Product: vBulletin
- Hook Location: global_start
- Title: Small Sponsor Images
- Plugin PHP Code (edit the include path to yours and note this will not show the images on register.php):

Code:

if (THIS_SCRIPT != 'register') {
ob_start();
include('/home/username/domain.com/forums/sponsors.php');
$includedphp = ob_get_contents();
ob_end_clean();
}


- Plugin is active: Yes

3) Edit your "footer" template and add "$includedphp" where you want the list of images to show up.

elavocato 08-30-2012 10:29 AM

how do i use it for vb4.1.9
i need it for side blocks


All times are GMT. The time now is 10:09 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.08040 seconds
  • Memory Usage 1,719KB
  • 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
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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