Подскажите, как в модуле статичных страничек сделать так, чтобы список выводился не со старой к новой, а старые внизу - новые наверху...
Версия системы: Open SLAED 1.*
Версия PHP: PHP 5
Сервер: Сервер в интернете
<?php
if (!defined('MODULE_FILE')) {
Header("Location: ../../index.php");
exit;
}
get_lang($conf['name']);
function spage() {
global $prefix, $db;
head();
open();
$result = $db->sql_query("SELECT pgid, name FROM ".$prefix."_spage ORDER BY pgid ASC");
echo "<ul>";
while (list($pgid, $name) = $db->sql_fetchrow($result)) {
echo "<li><a Href=\"index.php?name=spage&op=view&id=".$pgid."\">".$name."</a></li>";
}
echo "</ul>";
close();
foot();
}
function view() {
global $prefix, $db, $bodytext, $pagetitle, $conf;
head();
$id = intval($_GET['id']);
$result = $db->sql_query("SELECT name, bodytext FROM ".$prefix."_spage WHERE pgid = '$id'");
list($name, $bodytext) = $db->sql_fetchrow($result);
$pagetitle = "".$conf['defis']." $name";
$bodytext = bb_decode($bodytext, 'page');
$text = "<h1>".$name."</h1>".$bodytext."";
open();
echo "".$text."";
close();
foot();
}
switch($op) {
default:
spage();
break;
case "view":
view();
break;
}
?><?php
if (!defined("ADMIN_FILE") || !is_admin_modul("spage")) die("Illegal File Access");
function spage_navi() {
global $admin_file;
panel();
open();
echo "<h1>"._SPAGE."</h1>"
."<h5>[ <a href=\"".$admin_file.".php?op=spage\">"._HOME."</a>"
." | <a href=\"".$admin_file.".php?op=spage_add\">"._ADD."</a> ]</h5>";
close();
}
function spage() {
global $prefix, $db, $admin_file;
head();
spage_navi();
$result = $db->sql_query("SELECT pgid, name FROM ".$prefix."_spage ORDER BY pgid ASC");
if ($db->sql_numrows($result) > 0) {
open();
echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" class=\"sort\" id=\"sort_id\"><tr><th width=\"25\">"._ID."</th><th>"._SPAGET."</th><th width=\"80\">"._FUNCTIONS."</th></tr>";
while (list($pgid, $name) = $db->sql_fetchrow($result)) {
echo "<tr class=\"bgcolor1\"><td align=\"center\">".$pgid."</td>"
."<td >".$name."</td>"
."<td align=\"center\">".ad_edit("".$admin_file.".php?op=spage_add&id=".$pgid."")." ".ad_delete("".$admin_file.".php?op=spage_delete&id=".$pgid."".$refer."", $name)."</td></tr>";
}
echo "</table>";
close();
} else {warning(""._NO_INFO."", "", "", 2);}
foot();
}
function spage_add() {
global $prefix, $db, $admin_file, $conf, $stop;
head();
spage_navi();
if (isset($_REQUEST['id'])) {
$pgid = intval($_REQUEST['id']);
$result = $db->sql_query("SELECT name, bodytext FROM ".$prefix."_spage WHERE pgid='$pgid'");
list($name, $bodytext) = $db->sql_fetchrow($result);
} else {
$pgid = $_POST['pgid'];
$name = $_POST['name'];
$bodytext = save_text($_POST['bodytext']);
}
if ($stop) warning($stop, "", "", 1);
if ($bodytext) preview($name, $bodytext);
open();
echo "<form name=\"post\" action=\"".$admin_file.".php\" method=\"post\">"
."<div class=\"left\">"._SPAGET.":</div><div class=\"center\"><input type=\"text\" name=\"name\" value=\"".$name."\" size=\"65\" class=\"admin\"></div>"
."<div class=\"left\">"._SPAGEC.":</div><div class=\"center\">".textarea("1", "bodytext", replace_break($bodytext), "spage", "30")."</div>"
."<div class=\"button\"><select name=\"posttype\">"
."<option value=\"preview\">"._PREVIEW."</option>"
."<option value=\"save\">"._SEND."</option></select>"
."<input type=\"hidden\" name=\"pgid\" value=\"$pgid\">"
."<input type=\"hidden\" name=\"op\" value=\"spage_save\">"
." <input type=\"submit\" value=\""._OK."\" class=\"fbutton\"></div></form>";
close();
foot();
}
function spage_save() {
global $prefix, $db, $admin_file, $stop;
$pgid = intval($_POST['pgid']);
$name = save_text($_POST['name']);
$bodytext = save_text($_POST['bodytext']);
if (!$name) $stop = ""._CERROR."";
if (!$bodytext) $stop = ""._CERROR1."";
if (!$stop && $_POST['posttype'] == "save") {
if ($pgid) {
$db->sql_query("UPDATE ".$prefix."_spage SET name='$name', bodytext='$bodytext' WHERE pgid='$pgid'");
} else {
$db->sql_query("INSERT INTO ".$prefix."_spage (pgid, name, bodytext) VALUES (NULL, '$name', '$bodytext')");
}
Header("Location: ".$admin_file.".php?op=spage");
} else {
spage_add();
}
}
switch($op) {
case "spage":
spage();
break;
case "spage_add":
spage_add();
break;
case "spage_save":
spage_save();
break;
case "spage_delete":
$db->sql_query("DELETE FROM ".$prefix."_spage WHERE pgid='".$id."'");
referer("".$admin_file.".php?op=spage");
break;
}
?>Форум
Контакты