PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of S.M.   PHP 5 Fortune Class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: PHP5 Fortune Class Example
Class: PHP 5 Fortune Class
Pick a random quote from pre-defined text files
Author: By
Last change:
Date: 19 years ago
Size: 469 bytes
 

Contents

Class file image Download
<?php

require_once './fortune.cl.php';

$dir = './';
$ex1 = 'test1.fortune';
$ex2 = 'test2.fortune';

// Quote from a desired fortune file
echo "From the file 'example1.fortune':\n";
echo
'<pre>'.Fortune::quote($dir.$ex1).'</pre>';

echo
"From the file 'example2.fortune':\n";
echo
'<pre>'.Fortune::quote($dir.$ex2).'</pre>';

// Quote from all fortune files found in the directory
echo "From the current directory:\n";
echo
'<pre>'.Fortune::quote($dir).'</pre>';

?>