Ich möchte, dass die seitenzahl unter den news steht, hab schon mehrere versionen probiert, aber bekomm es einfach nicht hin. hier der code:
PHP Code:
<?php
//set root & include path
$isWin = (substr(PHP_OS, 0, 3) == 'WIN') ? true : false;
if($isWin) { //win32
define(TN_PATH, dirname(__FILE__).chr(92));
$separator = ";";
} else {
define(TN_PATH, dirname(__FILE__).chr(47));
$separator = ":";
}
ini_set("include_path", dirname(__FILE__).$delimiter.$separator.ini_get("include_path"));
require("conf/tn_conf.inc.php");
require("conf/tn_setlocale.inc.php");
ini_restore("include_path");
//determine language
unset($l);
$l = empty($lang) ? TN_DEFAULT_LANG : trim(strtolower($lang));
$archiv = empty($tn_lang[$l]) ? "archive" : $tn_lang[$l];
if(!empty($tn_countries[$l])) {
$langs = explode(":", $tn_countries[$l]);
$l = $isWin ? $langs[1] : $langs[0];
}
setlocale(LC_TIME, $l);
list($myFile, $total) = get_page($HTTP_GET_VARS["tns"]);
$theFile = $HTTP_SERVER_VARS["REQUEST_URI"];
$theFile = preg_replace("/&tns=[0-9]*$|tns=[0-9]*&|\?tns=[0-9]*$/", "", $theFile);
if(!ereg("\?", $theFile)) $theFile .= "?";
if (($HTTP_GET_VARS["tns"] == 1 || !isset($HTTP_GET_VARS["tns"])) && $total > 1) {
?>
<p align="right" style="font-size:9pt;">
<b>⇒ <a href="<?php print $theFile."&tns=2"; ?>"><?php print $archiv; ?></a></b>
</p>
<?php
} else if (isset($HTTP_GET_VARS["tns"]) && $HTTP_GET_VARS["tns"] != 1) {
?>
<p align="right" style="font-size:9pt;">
<?php
for($i=1;$i<=$total;$i++) {
if($HTTP_GET_VARS["tns"] != $i) {
?>
<b>[<a href="<?php print $theFile."&tns=".$i; ?>"><?php print $i; ?></a>]</b>
<?php
} else {
?>
<b>[<?php print $i; ?>]</b>
<?php
}
}
}
foreach($myFile as $val) {
$entry = explode("|", $val);
if(is_array($entry)) {
$date = strftime("%A, %d. %B %Y (%H:%M:%S)", $entry[1]);
/********************
HERE YOU CAN CHANGE THE HTML CODE FOR THE ENTRIES
********************/
?>
<br />
<div style="font-size:9pt;border-bottom:2px ridge blue;text-transformation:capitalize;">
<b><?php print $date; ?></b>
</div>
<p align="justify" style="font-size:9pt;">
<?php print $entry[2]; ?>
</p>
<?php
/********************
END
********************/
}
}
/*
* >>> creates array with current page entries <<<
* integer $page: page to show
* return array: entries to show; number of pages
*/
function get_page($page) {
$page = empty($page) ? "1" : $page;
$first = ($page - 1) * TN_ITEM_CNT;
if($fd = fopen(TN_PATH.TN_FILE, "r")) {
$cnt = -1;
while(!feof($fd)) {
$line = fgets($fd, 4096);
$cnt++;
if($cnt >= $first && sizeof($items) < TN_ITEM_CNT) $items[] = $line;
}
fclose($fd);
}
$items = empty($items) ? array() : $items;
return array($items, ceil(($cnt+1)/TN_ITEM_CNT));
}
?>
Comment