PHP-Freebies.com - Random Quotes

php-freebies.com

PF Random Quotes (1.0)

Requirements:

  • PHP 4+

Features/Benefits:

  • Database not needed
  • Requires including only one line of code to your .php page
  • Uses a text file for the quotes
  • You can use HTML to format the quote's display

Installation:

  1. Download the zip file and extract
  2. The extraction will result in 2 php files, a text file and read_me stuff
    • quotes.txt
    • quotes1.php
    • quotes2.php
    • readme.txt
  3. Open quotes.txt with a text editor and edit the quotes (detailed instructions below)
  4. You have 2 options, quotes1.php or quotes2.php;
    • quotes1.php will output your random quote using the following format:
      <p class="quote">random quote text</p>
      <p class="author">quote author</p>
      ...that is, with HTML code generated for you, then you can use CSS to format these paragraphs
    • quotes2.php, on the other hand, will output NO HTML, just raw text, so if you want to for instance, enclose the quotes with <p> tags, you will have to do so by editing the quotes.txt file
  5. Upload the quotes.txt file and either quotes1.php or quotes2.php depending on your choice above, to the server, preferably in the same directory of the page you want the quotes to display
  6. Now edit the page/file you want the quotes to show(must have a .php extension) and insert this code where you want it to show:
    • <?php include('quotes1.php'); ?>
      note that if you prefer quotes2.php substitute accordingly above
      note that if you didn't upload the quotes1.php file and quotes.txt file to the same directory where your page is, then you will have to adjust the code above, for example:
      <?php include('http://www.mysite.com/quotes1.php'); ?>
  7. That's it!

Editing the quotes.txt file:

Editing the quotes.txt is very simple and you will be able to figure it out by looking at the sample quotes.txt file, each quote starts with:

quote: text text text text ....

then a line break, then

author: John Doe

for the corresponding author, then repeat again

In case you opted for quotes2.php then, you can use HTML code, for example:

quote: <p>text text text text text<br>

author: John Doe</p>

Download:

Soccer  |  Xbox Mod Chip  |  Ayesha Takia  |  Isulong Seoph  |  Es Hotel  |  Hotel Fazenda   |  Vestidos de Noiva   |  Free Games   |  OSWD and Webmaster Forum