I liked to make a new function,i could do what i want in javascript,but i dont like it.
So if will it do if i put the code in the bb_functions file or do i have to make a new _func file for this.I want ot call it from a template,like main_header.html.If its too hard ot do,tell i skip it.
It's a random quote displayer.
include_once"$root/inc/random.php"; //main script
$filename = "$root/db/quotes.db";//database
$lines = file($filename);
$numQuotes = count ($lines);
$ranNum = rand(1, $numQuotes);
$line = $lines[$ranNum-1];
$element = explode("::",$line);
$theQuote = $element[0];
$theRef = $element[1];
$theLink = $element[2];
$output = outputTable($theQuote, $theRef, $theLink);
echo $output;
random.php
<?php function outputLine($theQuote, $theRef, $theLink){?>
<?php echo $theQuote; ?> - <a href="<?php echo $theLink; ?>" target="_blank"><?php echo $theRef; ?></a>
<?php }?><?php function outputTable($theQuote, $theRef, $theLink){?>
<a href="<?php echo $theLink; ?>" target="_blank"><?php echo $theRef; ?></a><br/><?php echo $theQuote; ?></a>
<?php }?> |