Thema: "Neue Einträge" anzeigen |
|
Wer die neusten 3 Einträge auf seiner Startseite anzeigen lassen will, wie hier im Webverzeichnis sollte folgendes machen:
1. eine leere Datei z.B. neu.php auf den Webspace laden
2. folgenden Code in "neu.php" reinkopieren:
<table class="bg" cellspacing="0" cellpadding="0" width="<? echo $rw ?>">
<tr>
<td> </td>
</tr>
<tr>
<td class="text">Neue Einträge <img src="<? echo $dirurl ?>/gfx/neu.gif" alt="Neue Einträge"></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<? include "config.php";
$result=@mysql_query("select * from content ORDER BY ORD DESC Limit 3");
while($row=@mysql_fetch_row($result)) {
$url=$row[2];
$titel=$row[3];
$text=$row[4];
$idA=$row[0];
$idB=$row[1];
if($idA=="0") {
$result111=@mysql_query("select * from verzeichnis where ID='$idB' order by titel asc");
while($row111=@mysql_fetch_array($result111)) {
$title=$row111[titel];
$title2=$row111[web];
$kat="<a class=\"date\" href=\"$dirurl/$title2.html\" title=\"$title\">Kategorie: $title</a>";
}
}
echo "<table cellspacing=\"0\" cellpadding=\"0\" width=\"$rw\">
<tr>
<td>
<table cellspacing=\"0\" cellpadding=\"0\" width=\"80%\">
<tr>
<td class=\"ad1 adtext\" width=\"100%\" valign=\"top\">
<div><a class=\"adlink\" target=\"_blank\" title=\"$titel\" href=\"$url\">$titel</a></div>
<div>".nl2br($text)."</div>
</td>
</tr>
<tr>
<td class=\"date\">$kat</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
";}
?>
<table class="bg" cellspacing="0" cellpadding="0" width="<? echo $rw ?>">
<tr>
<td class="date"><a class="date "href="<? echo $dirurl ?>/neue-eintraege.html" title="Neue Einträge"><i>weitere</i></a></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
Wer dann noch die neusten 30 Einträge auf einer extra Seite anzeigen lassen möchte, erstellet eine Datei mit dem Namen neue-eintraege.php, passt die .htaccess Datei entsprechend an, indem man die Zeile
RewriteRule neue-eintraege.html neue-eintraege.php
hinzufügt.
In die Datei neue-eintraege.php folgenden Code einfügen:
<? include "config.php" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Neue Einträge - <? echo $sitetitle ?></title>
<meta name="Description" content="Die 30 neuesten Einträge bei <? echo $sitetitle ?>">
<meta name="robots" content="index, follow">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="page-enter" content="blendtrans(duration=0.1)">
<meta http-equiv="page-exit" content="blendtrans(duration=0.1)">
<link href="<? echo $dirurl ?>/gfx/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<? include "header.php" ?>
<table class="bg" cellspacing="0" cellpadding="0" width="<? echo $main ?>">
<tr>
<td style="padding-left: 10px;"><a class="index" href="<? echo $dirurl ?>/" title="Startseite">Startseite</a>
<? echo $sep ?> <a class="index" href="<? echo $dirurl ?>/neue-eintraege.html.php" title="Neue Einträge">Neue Einträge</a>
</td>
</tr>
</table>
<table class="bg" cellspacing="0" cellpadding="0" width="<? echo $main ?>">
<tr>
<td width="<? echo $lw ?>" valign="top" height="280">
<? include "navi-left.php" ?>
</td>
<td width="<? echo $rw ?>" valign="top">
<table class="bg" cellspacing="0" cellpadding="0" width="<? echo $rw ?>">
<tr>
<td> </td>
</tr>
<tr>
<td class="text" colspan="4">Die 30 neuesten Einträge im <? echo $sitetitle ?></td>
</tr>
</tr>
<tr>
<td> </td>
</tr>
</table>
<? include "config.php";
@mysql_connect("$host","$dbuser","$dbpw") or die ("Es gibt leider Probleme mit der Datenbank. <br>Bitte versuchen sie es erneut.");
@mysql_select_db("$db") or die ("Datenbank nicht vorhanden");
$result=@mysql_query("select * from content ORDER BY ORD DESC Limit 30");
while($row=@mysql_fetch_row($result)) {
$url=$row[2];
$titel=$row[3];
$text=$row[4];
$idA=$row[0];
$idB=$row[1];
if($idA=="0") {
$result111=@mysql_query("select * from verzeichnis where ID='$idB' order by titel asc");
while($row111=@mysql_fetch_array($result111)) {
$title=$row111[titel];
$title2=$row111[web];
$kat="<a class=\"date\" href=\"$dirurl/$title2.html\" title=\"$title\">Kategorie: $title</a>";
}
}
echo "<table cellspacing=\"0\" cellpadding=\"0\" width=\"$rw\">
<tr>
<td>
<table cellspacing=\"0\" cellpadding=\"0\" width=\"80%\">
<tr>
<td class=\"ad1 adtext\" width=\"100%\" valign=\"top\">
<div><a class=\"adlink\" target=\"_blank\" title=\"$titel\" href=\"$url\">$titel</a></div>
<div>".nl2br($text)."</div>
</td>
</tr>
<tr>
<td class=\"date\">$kat</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
";}
?>
</table>
<? include "footer.php" ?>
_________________ mein Webkatalog ... & Suma Se Download
|
|
|
|
|
Ok besten dank genau das habe ich heute noch gesucht
du hast in deiner beschreibung noch zum anzeigen auf der startseite noch vergessen das
<? include "neu.php" ?>
an die stelle zu setzen wo man die neusten 3 einträge sehen möchte.
aber bei mir läuft es jetzt
_________________ Firmenverzeichnis
|
|
|
|
|
stimmt
Die "neu.php" dann auf der Startseite z.B. so einfügen:
... ?>
</tr>
<tr>
<td> </td>
</tr>
</table>
<? include "neu.php" ?>
</table>
<? include "footer.php" ?>
_________________ mein Webkatalog ... & Suma Se Download
|
|
|
|
|
hallo,
hab das alles mal eingebaut und funktioniert auch prima soweit,
aber wenn ich ganz unten auf den button "weitere" (neue Einträge) klicke, kommt diese fehlermeldung:
+
+
+
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /neue-eintraege.html.
Reason: Document contains no data
+
+
+
wie kann ich dem abhelfen?
danke und gruß!
|
|
|
|
|
|
|
|
|
was meinst du mit "seite"?
hab eine Datei angelegt mit diesem namen und das script reinkopiert.
hmmm, bin ein leider kein fachmann in diesen dingen...
|
|
|
|
|
du musst jetzt nur noch diese Zeile
RewriteRule neue-eintraege.html neue-eintraege.php
in die .htaccess Datei einfügen.
So werden alle Anfragen der Datei neue-eintraege.html auf neue-eintraege.php weitergeleitet, da ja eigentlich nur diese auf dem Webspace ist.
_________________ mein Webkatalog ... & Suma Se Download
|
|
|
|
|
hab ich auch gemacht... so siht es in der ht.access aus:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301]
RewriteEngine On
RewriteRule impressum.html impressum.php
RewriteRule url-melden.html url-melden.php
RewriteRule ^(.*).html$ rubriken.php?www=$1
RewriteRule neue-eintraege.html neue-eintraege.php
|
|
|
|
|
Füg das mal so ein:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301]
RewriteEngine On
RewriteRule impressum.html impressum.php
RewriteRule kontakt.html kontakt.php
RewriteRule url-melden.html url-melden.php
RewriteRule neue-eintraege.html neue-eintraege.php
RewriteRule ^(.*).html$ rubriken.php?www=$1
_________________ mein Webkatalog ... & Suma Se Download
|
|
|
|
|
habs jetzt so:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301]
RewriteEngine On
RewriteRule impressum.html impressum.php
RewriteRule url-melden.html url-melden.php
RewriteRule neue-eintraege.html neue-eintraege.php
RewriteRule ^(.*).html$ rubriken.php?www=$1
habe die zeile mit konakt.php mal rausgenommen, weil eine kontakt.php
hab ich gar nicht.
aber jetzt geht es. danke!
worauf kommt es an?
das RewriteRule ^(.*).html$ rubriken.php?www=$1 ganz am schluß steht?
|
|
|
|
|
|
|
|
|
hallo zusammen,
ich habe ein problem mit dem "neu.gif" gehabt. und zwar woll ich das mit in den bereich einbinden indem der neue intrag steht. Ich habe es nun hinbekommen aber nur mit dem umstand, dass ich php geschlossen habe und nach dem bild wieder geöffnet habe. Anders habe ich dasnicht hinbekommen. Nun aber die Frage: geht das auch leichter?? bzw unkomplizierter?
$result111=@mysql_query("select * from verzeichnis where ID='$idB' order by titel asc");
while($row111=@mysql_fetch_array($result111)) {
$title=$row111[titel];
$title2=$row111[web];
$kat="<a class=\"date\" href=\"$dirurl/$title2.html\" title=\"$title\">Kategorie: $title</a>";
}
}
echo "<table cellspacing=\"0\" cellpadding=\"0\" width=\"$rw\">
<tr>
<td>
<table cellspacing=\"0\" cellpadding=\"0\" width=\"80%\">
<tr>
<td class=\"ad1 adtext\" width=\"100%\" valign=\"top\">"; ?>
<div><img src="gfx/neu.gif" alt="Neuer Eintrag">
<? include "config.php";
echo "<a class=\"adlink\" target=\"_blank\" title=\"$titel\" href=\"$url\">$titel</a></div>
<div>".nl2br($text)."</div>
</td>
</tr>
<tr>
<td class=\"date\">$kat</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
";}[/b]
der störfaktor war der punkt bei neu.gif.
vielen dank für tip bzw. anregungen wie ich das problem in zukunft eleganter umgehen kann.
danke
spaci76
|
|
|
|
|
Design-Maker · Beiträge: 3 |
ja so:
<td class=\"ad1 adtext\" width=\"100%\" valign=\"top\">
<div><img src=\"gfx/neu.gif\" alt=\"Neuer Eintrag\"> <a class=\"adlink\" target=\"_blank\" title=\"$titel\" href=\"$url\">$titel</a></div>
<div>".nl2br($text)."</div>
|
|
|
|
|
 |