%
///// Include required file(s) /////
require ("/www/sethi/html/ssi/common-php.inc");
// Set Quotes Stuff:
$numberQuotes = 10;
$numberFormats = 10;
$lineLength = 58;
$quotefile = "/www/sethi/html/ssi/quotes.txt";
// Fxn to get quotes and print them out:
// Get Quotes from file; pad with spaces depending on line length
// of ticker; escape any single quotes and build actual array
function FormatTheQuote() {
// Declare as global (so it doesn't just create a new, local var)
global $numberFormats, $lineLength, $quotefile;
// File Splitter Constant:
$quote_splitter = "-------------------------------------------------";
// Read in the guestbook file into a Variable (instead of an array):
$fcontents = join( '', file($quotefile) );
// Split input file into entries:
#$entries_arr = split( "$quote_splitter", $fcontents);
$entries_arr = preg_split( "/$quote_splitter/", $fcontents);
// How many quotes do we have?
$no_entries = sizeof($entries_arr) - 1;
#echo "We got $no_entries quotes!
";
// Print out elements (but skip the first, 0th, entry)
#while (list ($key, $val) = each ($entries_arr)) {
# echo "$key => $val
";
#}
srand ((double) microtime() * 10000000);
$rand_keys = array_rand ($entries_arr, $numberFormats);
#print $entries_arr[$rand_keys[0]]."
\n";
for ($x=0; $x<$no_entries;$x++) {
$str = $entries_arr[$x];
// This sequence hoses extraneous spaces at the BEGINNING of each line only!
// Explode array; hose redundant spaces in each array element;
// then implode it back together on \n's
$foo = explode("\n",$str);
$str = "";
while (list ($key, $val) = each ($foo)) {
if (strlen(trim($val)) > 0) { // Skip empty lines
$str .= ltrim($val) . "\n";
}
#;$str .= ltrim($val) . " ";
}
// Do word wrap AFTER hosing extraneous spaces!
#echo "String was:\n
$str
\n";
#;$str = DoWordWrap($str,$lineLength,""); // No padding now!
#echo "String is now:\n$str
\n";
// Replace all newlines AFTER word wrap with
$str = preg_replace("/\n/","
",$str);
// Print out result:
$y = $x + 1;
#echo "String is now:$str
";
#;echo "tickercontents[$y] = '$str';";
print <<
EOQ;
}
}
%>
Grab a comfy chair, sit back, and relax with some quotes that have
given us pause to reflect on life, to laugh (at others and
ourselves), or to simply be amused...
<% FormatTheQuote();%>
|
<% include("/www/sethi/html/ssi/navbar.html") %>
|
|