Temat wątku: Nowe Wiadomości :: Panel lub strona dodatkowa wyświetlająca listę artykułów.

Opublikowane przez Zbigniew dnia 26-02-2024 21:11
#1

A więc jak w temacie jeśli chcesz wyświetlić na jednej stronie listę wszystkich artykuły .
Można wykonać coś takiego .
Kod
<?php

require_once __DIR__.'/maincore.php';
require_once THEMES.'templates/header.php';
add_to_title('tytuł');
set_meta("description", "opis strony www deskryption.");

add_to_head("
.fc {
 border: 1px solid #1a1a1a;
 border-radius: 10px;
 padding: 5px;
}
.fc1 {
 background-color: #0000FF;
 border-top: 1px solid #1a1a1a;
 border-bottom: 2px solid #000080;
 border-radius: 9px;
 padding: 10px;
 font-size: 16px; /* Zmieniono rozmiar czcionki na 16px */
}
.lc {
 border: 1px solid #1a1a1a;
 border-radius: 9px;
 padding: 5px;
}
.lc1 {
 background-color: #0000FF;
 border-top: 1px solid #1a1a1a;
 border-bottom: 2px solid #1a1a1a;
 border-radius: 9px;
 padding: 1px;
}
");

echo "<table align='center'><tbody><tr>";
echo "<td class='fc' width='50%'>";
echo "<div align='center' class='fc1'></div><p><p>";
$qresult = dbquery("SELECT * FROM ".DB_ARTICLES." ORDER BY article_datestamp DESC LIMIT 15");
if (dbrows($qresult) != 0) {
 echo "<table width='100%' cellpadding='0' cellspacing='0'>";
 while ($data = dbarray($qresult)) {
 echo "<tr><td class='small' align='left'><b><a href='".BASEDIR."/infusions/articles/articles.php?article_id=".$data['article_id']."' title='".$data['article_subject']."'>";
 echo trimlink($data['article_subject'], 30)."</a></b></td><td class='small' align='right'>[".$data['article_reads']."]</td></tr>";
 }
 echo "</table>";
}
echo "</td>";

echo "<td class='lc' width='50%'>";
echo "<div class='lc1' align='center'><b></b></div><p><p>";
$qresult = dbquery("SELECT * FROM ".DB_ARTICLES." ORDER BY article_reads DESC LIMIT 15");
if (dbrows($qresult) != 0) {
 echo "<table width='100%' cellpadding='0' cellspacing='0'>";
 while ($data = dbarray($qresult)) {
 echo "<tr><td class='small' align='left'><b><a href='".BASEDIR."/infusions/articles/articles.php?article_id=".$data['article_id']."' title='".$data['article_subject']."'>";
 echo trimlink($data['article_subject'], 30)."</a></b></td><td class='small' align='right'>[".$data['article_reads']."]</td></tr>";
 }
 echo "</table>";
}
echo "</td></tr></tbody></table>";
closeside();

require_once THEMES.'templates/footer.php';
?>


Jeśli chcesz wyświetlić w panelu , nie sprawdzałem ale powinno działać.
Kod
<?php
add_to_head("
.fc {
 border: 1px solid #1a1a1a;
 border-radius: 10px;
 padding: 5px;
}
.fc1 {
 background-color: #0000FF;
 border-top: 1px solid #1a1a1a;
 border-bottom: 2px solid #000080;
 border-radius: 9px;
 padding: 10px;
 font-size: 16px; /* Zmieniono rozmiar czcionki na 16px */
}
.lc {
 border: 1px solid #1a1a1a;
 border-radius: 9px;
 padding: 5px;
}
.lc1 {
 background-color: #0000FF;
 border-top: 1px solid #1a1a1a;
 border-bottom: 2px solid #1a1a1a;
 border-radius: 9px;
 padding: 1px;
}
");

echo "<table align='center'><tbody><tr>";
echo "<td class='fc' width='50%'>";
echo "<div align='center' class='fc1'></div><p><p>";
$qresult = dbquery("SELECT * FROM ".DB_ARTICLES." ORDER BY article_datestamp DESC LIMIT 15");
if (dbrows($qresult) != 0) {
 echo "<table width='100%' cellpadding='0' cellspacing='0'>";
 while ($data = dbarray($qresult)) {
 echo "<tr><td class='small' align='left'><b><a href='".BASEDIR."/infusions/articles/articles.php?article_id=".$data['article_id']."' title='".$data['article_subject']."'>";
 echo trimlink($data['article_subject'], 30)."</a></b></td><td class='small' align='right'>[".$data['article_reads']."]</td></tr>";
 }
 echo "</table>";
}
echo "</td>";

echo "<td class='lc' width='50%'>";
echo "<div class='lc1' align='center'><b></b></div><p><p>";
$qresult = dbquery("SELECT * FROM ".DB_ARTICLES." ORDER BY article_reads DESC LIMIT 15");
if (dbrows($qresult) != 0) {
 echo "<table width='100%' cellpadding='0' cellspacing='0'>";
 while ($data = dbarray($qresult)) {
 echo "<tr><td class='small' align='left'><b><a href='".BASEDIR."/infusions/articles/articles.php?article_id=".$data['article_id']."' title='".$data['article_subject']."'>";
 echo trimlink($data['article_subject'], 30)."</a></b></td><td class='small' align='right'>[".$data['article_reads']."]</td></tr>";
 }
 echo "</table>";
}
echo "</td></tr></tbody></table>";
closeside();
?>


Zmiana limitu ilości artykułów.
Kod
article_reads DESC LIMIT 15");


Czy ten post był przydatny.

Edytowany przez Zbigniew dnia 09-04-2025 02:15