treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Need Advice - Random Content Generation

  • Hi all,

    I'm looking to include a small section (div) of content that contains recommendations/testimonials my client has received. I would like this div to appear in the header of every page and anytime a user visits/refreshes a page on the site I would like it to display random content (from the recommendations). I can think of 2 ways to do this: PHP pulling from a database, and using jQuery to "auto-refresh" every so often. Is there another good way of doing this? I'm not sure what the best-practice would be for this kind of situation, as I'm a bit of a newcomer to web design. Any advice is GREATLY appreciated.
    http://pennedweb.com/v2/images/web_question.gif
  • I have a php script that shows testimonials on my site.

    I don't care too much for it auto-refreshing while on the page, I just wanted it to be random at each page load.
  • I would go with the PHP approach, or you could use JavaScript with an array that randomly selects a number and passes it into the array and gets back a testimonial. If you wanted something that looks great and refreshes often why not go with a Flash approach, however as I said I would go with the PHP and database.
  • Thanks guys! I think I will go the PHP route.