Hello,
anyone know how I can get the daily content text pulled from a .txt file to be justified ?
The tagmaker php script I'm using in the php page is:-
<?php echo($theTag); ?>
and the tagmaker file code is :-
<script language="php">
/ ****************************************************************
TAGMAKER (c) 2001 Peter Kerl
Tips, Tags, Quotes for Webpages. Examples and more
Quote-Files you will find at:
http://www.passepartout.f2s.com
**************************************************************** /
//------------------------------------------------------------------
/ DEFAULT-SETTINGS /
$dbFile = "tags.txt"; // File containing your tags
// Signs used to separate the tags, according to your tag-file.
$sep = "%%";
$mode = "periodical"; // "sequence", "random" or "periodical"
$startNo = 1; // only in sequence-modus
$deleteRepeats = 10; // only random-modus. 10 times without duplicates
$period = "wday"; // the measure for changes in "periodical"-mode.
/ "wday" = day of week (7); "mday" = day of month (31);
"yday" = day of year (365); "hours" = hour of day (24); /
//-------------------------------------------------------------------
/ The CODE, do only change, if you know what you do /
// overrule default-settings:
if (isset($o_dbFile)) $dbFile = $o_dbFile;
if (isset($o_sep)) $sep = $o_sep;
if (isset($o_mode)) $mode = $o_mode;
if (isset($o_startNo)) $startNo = $o_startNo;
if (isset($o_deleteRepeats)) $deleteRepeats = $o_deleteRepeats;
if (isset($o_period)) $period = $o_period;
$tags = FileToArray($dbFile);
if (is_array($tags)) {
if ($mode == "sequence") {
if (! isset($index)) {$index = $startNo - 1;}
if ($index < 0 || $index >= count($tags)) {$index = 0;}
$x[] = $index;
$theTag = TextToHTML($tags[$index]);
$index++;
}
elseif ($mode == "random") {
srand ((double) microtime() * 10000000);
if (! isset($index)) {$index = getRKey($tags);}
$x[] = $index;
$theTag = TextToHTML($tags[$index]);
if ($deleteRepeats > count($tags)) {$deleteRepeats = count($tags);}
if (count($x) >= $deleteRepeats) {$x = array($index);}
$index = deleteReps($tags);
}
else { // periodical
$t_stamp = time();
$arrDate = getdate($t_stamp);
$number = $arrDate[$period] - 1;
$max = count($tags);
if ($number >= $max) {$number %= $max;}
elseif ($number < 0) {$number = $max - 1;}
$theTag = TextToHTML($tags[$number]);
}
}
else {
$x = array(0);
$theTag = "File '$dbFile' not found";
}
echo "<!-- TAGMAKER - Tips & Tags (c) 2001 P. Kerl ";
echo "\r\n\t[www.passepartout.f2s.com] -->";
$x_sum = "";
if ($deleteRepeats > 1 && $mode == "random") {
reset ($x);
while (list(, $value) = each ($x)) {
$x_sum .= "&x%5B%5D=$value";
}
}
$data = "?index=$index$x_sum";
function FileToArray($filename) {
global $sep;
if (file_exists($filename)) {
if (filesize($filename) == 0) return 0;
$fcontent = join ('', file ($filename));
return explode ($sep, $fcontent);
}
return 0;
}
function deleteReps($tags) {
global $x;
do {
$ndx = getRKey($tags);
$found = 0;
reset ($x);
while (list(, $value) = each ($x)) {
if ($ndx == $value) {
$found = 1;
break;
}
}
} while ($found == 1);
return $ndx;
}
function getRKey($arr){
$c = count($arr) - 1;
return rand(0, $c);
}
function TextToHTML($text) {
$text = trim($text);
$text = str_replace("\n\n", "<p>", $text);
$text = str_replace("\n\r\n", "<p>", $text);
$text = str_replace("\n", "<br>", $text);
$text = str_replace("\t", " ", $text);
$text = str_replace(" ", " ", $text);
return $text;
}
</script>