vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Rotate your logos (https://vborg.vbsupport.ru/showthread.php?t=38320)

tkieffer 05-07-2002 04:15 PM

Nifty! It's all fixed.

You get a big shiny golden star in my book!

geniuscrew 05-08-2002 11:26 AM

Quote:

Originally posted by Sparkz
Besides, this saves bandwidth, as it is server side.

Using DHTML, you'd have to pass the whole list if images to the client, plus the code to actually do the pick which image to show.

That's why i don't use it lol

Nice 'hack' though :bunny:

Sparkz 05-08-2002 12:30 PM

If you only have a few images to rotate, you could just set the content of $logos manually. Would result in a bit less processing time.

Something like:
PHP Code:

$logodir "images/";
$logos = array
(
   
$logodir "filename.png",
   
$logodir "filename2.png"
);

function 
make_seed() {
    list(
$usec$sec) = explode(' 'microtime());
    return (float) 
$sec + ((float) $usec 100000);
}
srand(make_seed());

$logo rand(0count ($logos) - 1);
$titleimage $logos[$logo]; 

Would save the server from having to list the directory every time a page was loaded.

tkieffer 05-10-2002 12:13 PM

Excellent! I upgraded to the predefined array and it is noticably faster.

afterlab 06-23-2002 08:35 PM

Is there anyway that I can get it show the random image plus a link for each one. Basically, all I need is another variable that just displays the filename, without the directory, and extensions.

afterlab 06-28-2002 11:13 AM

Anyone? [BUMP]

Sparkz 06-28-2002 02:21 PM

Try this:
PHP Code:

$logodir "images/";
$logos = array
(
   array (
$logodir "filename.png","http://mylink/"),
   array (
$logodir "filename2.png","http://anotherlink/")
);

function 
make_seed() {
    list(
$usec$sec) = explode(' 'microtime());
    return (float) 
$sec + ((float) $usec 100000);
}
srand(make_seed());

$logo rand(0count ($logos) - 1);
list (
$titleimage$titleurl) = $logos[$logo]; 

Now you can use $titleimage and $titleurl in your templates.

afterlab 06-28-2002 08:52 PM

Worked perfect, thanks.

Sparkz 06-28-2002 10:53 PM

My pleasure :D

Sparkz 06-28-2002 10:56 PM

Just looked at your site... Like what you did with this mod :)


All times are GMT. The time now is 12:40 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.02835 seconds
  • Memory Usage 1,737KB
  • 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_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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