![]() |
random content on page load
hey everyone,
I have a question, I am making a website up for someone and they would like random testimonials to show when the page is loaded. my question really is, what would be the best way to do this? reason I ask is, I dont know if they will have enough testimonials to warrent a database, but I am not sure as to whether they want clients to add in their own testimonials, plus if this will be moderated. is there a way to store data like what is said, by who and what company (if any) they work for, so that when I randomise it, I get all of the correct data so this can be viewed on load? ik |
Re: random content on page load
You could have a separate page for each and then some basic php pr javascript to go to one of the random pages. PHP would be better since it works on all computers, but with javascript it would have to be enabled. Here is the PHP I would use.
random.php PHP Code:
|
Re: random content on page load
Quote:
anyway, I was thinking of making a basic page that someone can enter details and storing this as an xml file (and appends to the file), then I could generate a random quote from the xml file, would this work? not looking for links to anything just a testimonial really. Sorry forgot to say, the testimonials are supposed to be vied in one page that has other info on it. ik |
Re: random content on page load
I have got a script that reads random text files so far... I found this while searching how to's here: http://uk2.php.net/
PHP Code:
but, is there anyway I can force my area, that I want to echo out to, stay at the size I intended it to be, as with this, the table columnis changing size. or will this have to be done by using the \n in the text file? forget that, I am going down teh array route now, as it keeps the page looking fine. ik |
Re: random content on page load
sorry, could someone who is better at php than me help out with a location statement
I have the php file in the same directory but I want to put it somewhere else, cgi-bin I cant get the absolute path to work with includes, how can I get it to find the directory... e.g. www/a/this.html (php was in this directory) www/cgi/thephp.php (point to here) I tried, includes('absolute path'); not working but all others I tried dont work, but the script in the same directory is working, so its not the file. |
Re: random content on page load
If its a Windows system and you had to use an absolute path you'd need the drive letter too, if its Linux you'll need the full path from the root file system, you can however use a relative path like include("includes/include.php");
|
Re: random content on page load
Quote:
I figured out why it was not seeing it correctly, I had the blooming same php file in the directoy so I think it was confusing |
| All times are GMT +1. The time now is 05:21. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum