The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
I am using the following code to show random pictures. is there an easy way to generate more code. Say if i wanted it to go to 1000 or more.
Code:
$random_number = rand(1, 5); $random_picture[1] = '<a href="misc.php?do=page&template=ranpic"><img src="images/random/0001.jpg" alt="Click For Next" border="0" /></a>'; $random_picture[2] = '<a href="misc.php?do=page&template=ranpic"><img src="images/random/0002.jpg" alt="Click For Next" border="0" /></a>'; $random_picture[3] = '<a href="misc.php?do=page&template=ranpic"><img src="images/random/0003.jpg" alt="Click For Next" border="0" /></a>'; $random_picture[4] = '<a href="misc.php?do=page&template=ranpic"><img src="images/random/0004.jpg" alt="Click For Next" border="0" /></a>'; $random_picture[5] = '<a href="misc.php?do=page&template=ranpic"><img src="images/random/0005.jpg" alt="Click For Next" border="0" /></a>'; Basically i want to add everything between 1 and 1000 automatically: Code:
$random_number = rand(1, 1000); $random_picture[6] = '<a href="misc.php?do=page&template=ranpic"><img src="images/random/0006.jpg" alt="Click For Next" border="0" /></a>'; $random_picture[7] = '<a href="misc.php?do=page&template=ranpic"><img src="images/random/0007.jpg" alt="Click For Next" border="0" /></a>'; and everything between up to 1000, or more if needed. (can this be automated?) $random_picture[1000] = '<a href="misc.php?do=page&template=ranpic"><img src="images/random/1000.jpg" alt="Click For Next" border="0" /></a>'; |
#2
|
|||
|
|||
![]()
I think array_rand should do this.
http://www.php.net/array_rand |
#3
|
|||
|
|||
![]()
I don't think that will help. I just need to generate that code from 1-1000 without having to do it manually in word pad. Any ideas on how to do that?
|
#4
|
|||
|
|||
![]()
Sorry, i've misunderstood you.
You could use "for" ? PHP Code:
|
#5
|
||||
|
||||
![]() PHP Code:
|
#6
|
|||
|
|||
![]() Quote:
Thanks again |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|