vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Random Banner/Reply BG (https://vborg.vbsupport.ru/showthread.php?t=48589)

Shpookdefied 02-06-2003 03:43 AM

Random Banner/Reply BG
 
I am customizing Mist's Random Banner hack for use in Firefly's Fast Reply. I'm trying to get the textarea background to come up as random BG's, but it doesnt seem to be working. This is what I have in showthread.php:

PHP Code:

//Define Variables //
$qrback[1]="qrback1.jpg";
$qrback[2]="qrback2.jpg";
$qrback[3]="qrback3.jpg";
$qrback[4]="qrback4.jpg";
$numbgs count($qrback);

// Generate randomness
$num rand(1,$numbgs);

//output background
$qrback "{imagesfolders}/qrback$num"

And this is in the showthread_replybox template:

PHP Code:

<textarea name="message" rows="9" cols="$textareacolswrap="virtual" tabindex="1"  style="background-image: url('$qrback'); 
background-repeat: no-repeat; background-attachment: fixed"
></textarea

I have also tried this in showthread.php:

PHP Code:

//output background
$qrback "<textarea name="message" rows="9" cols="$textareacols" wrap="virtual" tabindex="1"
  style="
background-imageurl('qrback$num); background-repeat: no-repeat; background-attachment: fixed"></textarea>"; 

And this in showthread_replybox:

PHP Code:

<td>$qrback><br><smallfont><a href="javascript:checklength(document.vbform);">[check message length]</a></smallfont></td

I'm not very good with PHP, so I have no clue why it's not working. Can anyone help?

And btw, I am not and will not take credit for this if/when I get it to work. Mist can release it as his own if he wishes.

Shpookdefied 02-06-2003 06:30 PM

BTW, In showthread.php, I've placed the code underneath this:

PHP Code:

        eval("\$replybox = \"".gettemplate('showthread_replybox')."\";");



mr e 02-06-2003 09:18 PM

dont you need ".jpg" on the end? also you could do it like this

PHP Code:

// Generate randomness
$num rand(1,4); //make max number the number of images you have

//output background
$qrback "{imagesfolders}/qrback$num.jpg"


Shpookdefied 02-06-2003 10:49 PM

Well, from my understand, the file is defined here:

PHP Code:

$qrback[1]="qrback1.jpg"

so qrback$num would define the $qrback call as qrback1.jpg

Also,
PHP Code:

$num rand(1,4); 

is doing the same thing as
PHP Code:

$numbgs count($qrback);

// Generate randomness
$num rand(1,$numbgs); 

But in the bottom example, it just counts the number of variables and applies the randomization to that. Just about the same thing, except you don't have to set the rand max number when adding a new variable. :D

So I've tried a few different things, still to no avail. But I WILL have this working before I put my board up :D

mr e 02-07-2003 12:03 AM

i know i have to set the max number, but i dont have to type each file in, that part doesn't matter, if you want to do it your way do this

PHP Code:

//Define Variables //
$qrback[1]="qrback1.jpg";
$qrback[2]="qrback2.jpg";
$qrback[3]="qrback3.jpg";
$qrback[4]="qrback4.jpg";
$numbgs count($qrback);

// Generate randomness
$num rand(1,$numbgs);

//output background
$qrback "{imagesfolders}/$qrback[$num]"

most of this is just repetitive, you could just randomize the number, your way only REALLY matters if they were named for ex: boat.jpg, plane.gif, since then you'd have to define the names somehow, you have all the names "qrback#.jpg" so my way would be faster

Shpookdefied 02-07-2003 03:33 AM

Okay, I see what your saying now. I misunderstood you at first. Let me go give this a try, and I'll come back with the results.

Shpookdefied 02-07-2003 09:05 PM

Okay, well I've tried, still nothing. I'm not getting any errors, but the BG just isnt showing up. Help?

mr e 02-08-2003 04:41 AM

are you sure the html for the bg is correct?

try this for the code in showthread.php

above this
PHP Code:

eval("dooutput(\"".gettemplate("showpost")."\");"); 

put this
PHP Code:

    // Generate randomness
    
$num rand(1,4); //make max number the number of images you have

    //output background
    
$qrback "{imagesfolders}/qrback$num.jpg"

haven't tested it, but try that and make sure the html is correct

Shpookdefied 02-08-2003 04:13 PM

Above? Hmmm, I assumed below.:D Okay, I'll go give it a shot.

Dpcows 02-14-2003 08:44 PM

Quote:

Originally posted by Shpookdefied

PHP Code:

//Define Variables //
$qrback[1]="qrback1.jpg";
$qrback[2]="qrback2.jpg";
$qrback[3]="qrback3.jpg";
$qrback[4]="qrback4.jpg";
$numbgs count($qrback);

// Generate randomness
$num rand(1,$numbgs);

//output background
$qrback "{imagesfolders}/qrback$num"


i think you need to look at your arrays.
the way you make then is good, but displaying it isn't it.

your doing this: qrback$num
this will generate: qrback1 or qrback2 and increase the numbers to the max you have set. your just telling it to show $num with qrback before it.

not showing anything from the array

to do the array correclty: $array_name[$value].
so for you it would be: $qrback[$num].
that would show them

hope this helps


All times are GMT. The time now is 03:49 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.01147 seconds
  • Memory Usage 1,772KB
  • 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
  • (13)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete