| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Apr 2006
Posts: 267
![]() | Random Rotation Script Hello, ????: NamePros.com http://www.namepros.com/programming/293444-random-rotation-script.html I have used the following php script to get random text in my website... HTML Code: <?php
$number=mt_rand(1, 6);
if ($number=="1") {
include "navrandom1.php";
}
if ($number=="2") {
include "navrandom2.php";
}
if ($number=="3") {
include "navrandom3.php";
}
if ($number=="4") {
include "navrandom4.php";
}
if ($number=="5") {
include "navrandom5.php";
}
if ($number=="6") {
include "navrandom6.php";
}
?> [HTML] HTML Code: <?php
if ($number=="?") {
include "navrandom?.php";
} |
| |
| | #2 (permalink) |
| Senior Member Join Date: Dec 2006 Location: England
Posts: 1,568
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Why not try something like this ![]() PHP Code: ????: NamePros.com http://www.namepros.com/showthread.php?t=293444 You cuold also use switch etc but this way is best . |
| |
| | THREAD STARTER #3 (permalink) |
| NamePros Regular Join Date: Apr 2006
Posts: 267
![]() | Figured it out (not on my own as I suck at PHP).... HTML Code: <?php
$paragraphs = array(
'Paragraph 1',
'Paragraph 2',
'Paragraph 3',
'Paragraph 4',
);
$random = $paragraphs[array_rand($paragraphs)];
echo $random;
?> |
| |
| | #4 (permalink) |
| NamePros Regular Join Date: Jul 2005
Posts: 274
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Programing can be tough! Good Job. I always suggest searching google for a few minutes if you run accross a problem.
__________________ ~TrafficSecret~ KickAssMovies.com - Funny Movies and Hot Babes Unsober.com - Drunken Media OvtCheck.com - Domain Tools HumorTrade.com - Humor Site Banner Exchange |
| |