| | |||||
| ||||||||
| Web Design Discussion Discussion of web design techniques, advice, browser issues, software, design firms. |
![]() | NamePros Design Contests | Forum Sponsorship |
| Join in on the FUN! You can start an affordable design contest and pick from entries talented members submit or you can enter a design contest for a chance to win CASH PRIZES! What are you waiting for? Get started in the fun TODAY! - Banners, Logos, Mascots, and MORE! (Please READ the design Contest section rules Prior to starting or entering a contest) | ||
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| New Member Join Date: Jul 2003
Posts: 7
![]() | How to load a different page each time page refreshes? Hi! For a new site I am creating, I need to do one of the following options: - Load a different home page each time user refreshes or enter site (I could be also just changing part of the code in the same page) - Load different random different images on the home page as a slide show (BUT, it can't be just 1 image. I have a set of 5 images, that need to change to other 5 images). Do you have any idea how to do eigther those? It can be a javascript code, HTML, or PHP. Thanks |
| |
| | #2 (permalink) |
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() | Something like this should probably work for everything you're wanting to do with some slight modification. Add this in your php page somewhere: PHP Code: PHP Code: You could also make it select a random page using includes and/or a switch statement or something like that. |
| |
| | THREAD STARTER #3 (permalink) |
| New Member Join Date: Jul 2003
Posts: 7
![]() | question Thanks for the response. But I have a question. The home page is not in PHP. Should I make another PHO page that will be accessed from the HMTL home page? or I just include that code in the HTML and it will work? Thanks |
| |
| | #4 (permalink) |
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() | If you want to use that on your page it would need to be a php file. You could just rename your page so it has .php extension rather than a .html extension and throw that code in it if your server supports php. Otherwise you'll probably want to use JavaScript. |
| |
| | #6 (permalink) |
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() | So your host doesn't allow you to use index.php as your default index page? Have you tried renaming it to index.php to verify that it does or doesn't work? I would bet that they do, but it is possible they don't. I know alot of servers will be set up to allow you to use either index.html index.htm index.php index.php3 index.php4 index.shtml and others as the index page. The index pages will probably be searched for similar to that order also. So first it will look for index.html, then if it don't exist, look for index.htm, then index.php etc., just depending on how they have it set up. ????: NamePros.com http://www.namepros.com/showthread.php?t=15074 Also you can actually rename all your .html files to .php files and they should work just the same. There's no real reason to do that though, unless your going to be using some php code. |
| |
| | THREAD STARTER #7 (permalink) |
| New Member Join Date: Jul 2003
Posts: 7
![]() | Great Great it works! I renamed the index,html to index.php Now, I have a question about the code. I have to set the whole array of images to be randomized right? Can't I just tell the script to go look in a folder and pick one? Thanks. What if instead of randomizing images, I want to randomize the HTML code that calls the images? Like in the case I want to load a different set of 5 images each time ? Thanks again!!! |
| |