You are here: Random HTML snippets with PHP include? « PHP Programming Language « IT news, forums, messages
Random HTML snippets with PHP include?

Posted by Kevin G. on 02/02/08 00:13

Hello all,

I have a flat HTML page with 3 distinct HTML tables, and I'm trying to
randomly display the tables when the page loads, without repeating.
My idea is to use the PHP include() function to pull in the page
content.

So what I've done so far was broke the full page down into 3 static
HTML files, each containing one of the tables. Then in the main index
page where I want to display the code randomly, I created a variable
using the rand() function -- and then within my include statement I'm
using the $rand variable to build the html filename to include.

The problem is that while the page does *work*, the rand function only
returns one random number and hence all three tables on the page turn
out to be duplicates. What I'm looking to do is make sure that all 3
HTML files are included into the page, but with no repeating, and each
of the 3 will show randomly on page load.

Here's an example of what I have currently: http://www.mollymaguires.net/rotating_html/

Not exactly a PHP guru, so any replies back regarding setting up an
array or custom functions to handle this situation need to be
explained pretty clearly :) Thanks in advance for any help!

KG

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация