Mailinglisten-Archive |
> ich habe es heute morgen schon einmal gepostet.
> Ich suche ein Script das im Bedarffall einen Weiter oder
Zurückbutton
> anbietet.
Hi,
hier (m)ein Skript, das sowas macht. Bitte selber anpassen...
CU, Axel <a.tietje_(at)_flynet.de>
--------------------------------
May the Source Be With You
--------------------------------
<?
if ($GLOBALS['start'] == ""){
$start = 0;
}
else {$start = $GLOBALS['start'];}
$cn = new termine;
$cn -> db_connect();
$step = 2;
$q = "SELECT COUNT(t_id) AS anzahl FROM termine";
$r = mysql_query ($q); if (mysql_errno() != 0){echo mysql_errno().":
".mysql_error()."<BR>"; die;}
$row = mysql_fetch_array ($r);
$anzahl = $row['anzahl'];
// $nextt
if ($start >= 0) {
$nextt = $start + $step;
$bis = $nextt;
}
if ($nextt >= $anzahl) {
$nextt = 0;
$bis = $anzahl;
}
// $prevv
if ($start <= 0) {
$prevv = 0;
}
if ($start > 0) {
$prevv = $start - $step;
}
$von = $start+1;
$news = $cn -> get_termine( $start, $step );
$anz = $news[0];
unset ($news[0]);
font ("newsdate");
echo "<b><font color=#003366>" .$anzahl . ' Termin'; echo $a =
(($anzahl > 1)||($anzahl == 0)) ? 'e':'';
echo ' vorhanden</font></b> - Anzeige: '.$von.' - '.$bis.'<p>';
font ("/newsdate");
while (list ($k, $v) = each ($news)){
font ("p");
echo "<dl><dt><a
href=\"javascript:showtermin(".$news[$k][0].");\"><b>".$news[$k][1]."<
/b></a></dt>";
font ("/p");
font ("newsdate");
echo "<dd>Veranstaltung am ".$news[$k][5]."<br>Ort:
".$news[$k][7]."<br>Kategorie: ".$news[$k][6].",
".$news[$k][3]."<br><br>";
font ("/newsdate");
font ("p");
echo $news[$k][2]."<br></dd></dl><br>\n";
font ("/p");
}
font ("p");
if (($nextt != 0)&&($start != 0)){
echo "<a href=\"index.php3?003&start=".$nextt."\"><b>weiter</b></a>
|";
echo "<a
href=\"index.php3?003&start=".$prevv."\"><b>zurück</b></a></dt>";
}
elseif (($nextt == 0)&&($prevv >= 0)){
echo "<a href=\"index.php3?003&start=".$prevv."\"><b>zurück</b></a>";
}
elseif (($start == 0)&&($nextt != 0)){
echo "<a href=\"index.php3?003&start=".$nextt."\"><b>weiter</b></a>";
}
font ("/p");
?>
php::bar PHP Wiki - Listenarchive