|
22.02.2010, 18:43
я перепробоал несколько вариантов, наример:
PHP код:
function terms($eid, $ltr, $min) {
global $module_name, $prefix, $sitename, $db, $perpage, $admin;
$perpage = 3;
$eid = intval($eid);
if (empty($eid))
{
$eid = '';
}
$row = $db->sql_fetchrow($db->sql_query("SELECT active FROM ".$prefix."_encyclopedia WHERE eid='$eid'"));
$active = intval($row['active']);
$row2 = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_encyclopedia WHERE eid='$eid'"));
$title = stripslashes(check_html($row2['title'], "nohtml"));
include("header.php");
title("$title");
OpenTable();
$tid = intval($tid);
if (($active == 1) OR (is_admin($admin))) {
if (($active != 1) AND (is_admin($admin))) {
echo "<center>"._YOURADMINENCY."</center><br><br>";
}
echo "<center>Please select one term from the following list:</center><br><br>"
."<table border=\"0\" align=\"center\">";
$result3 = $db->sql_query("SELECT tid, title FROM ".$prefix."_encyclopedia_text WHERE UPPER(title) LIKE '$ltr%' AND eid='$eid' limit $min, $perpage");
$min = 0;
$perpage = 3;
$fullcountresult = $db->sql_query("SELECT tid, title FROM ".$prefix."_encyclopedia_text WHERE UPPER(title) LIKE '$ltr%' AND eid='$eid'");
$numrows = $db->sql_numrows($fullcountresult);
if ($numrows == 0) {
echo "<center><i>"._NOCONTENTFORLETTER." $ltr.</i></center>";
}
while ($row3 = $db->sql_fetchrow($result3)) {
$tid = intval($row3['tid']);
$title = stripslashes(check_html($row3['title'], "nohtml"));
echo "<tr><td><a href=\"modules.php?name=$module_name&op=content&tid=$tid\ ">$title</a></td></tr>";
}
echo "</table><br><br>";
alpha($eid);
} else {
echo "<center>"._ENCYNOTACTIVE."<br><br>"
.""._GOBACK."</center>";
}
if ($numrows > 0)
/* Calculates how many pages exist. Which page one should be on, etc... */
$linkpagesint = ($numrows / $perpage);
$linkpageremainder = ($numrows % $perpage);
if ($linkpageremainder != 0) {
$linkpages = ceil($linkpagesint);
if ($numrows < $perpage) {
$linkpageremainder = 0;
}
} else {
$linkpages = $linkpagesint;
}
/* Page Numbering */
if ($linkpages!=1 && $linkpages!=0) {
echo "<br><br>";
echo ""._PAGE.": ";
$prev=$min-$perpage;
if ($prev>=0) {
echo " <b>[ <a href=\"modules.php?name=$module_name&op=terms&eid=$eid&lt r=$ltr&min=$prev&\">";
echo " << "._PREVIOUS."</a> ]</b> ";
}
$counter = 1;
$currentpage = ($max / $perpage);
while ($counter<=$linkpages ) {
$cpage = $counter;
$mintemp = ($perpage * $counter) - $perpage;
if ($counter == $currentpage) {
echo "<b>$counter</b> ";
} else {
echo "<a href=\"modules.php?name=$module_name&op=terms&eid=$eid&lt r=$ltr&min=$mintemp&\">$counter</a> ";
}
$counter++;
}
$next=$min+$perpage;
if ($x>=$perpage) {
echo " <b>[ <a href=\"modules.php?name=$module_name&op=terms&eid=$eid&lt r=$ltr&min=$max&\">";
echo " "._NEXT." >></a> ]</b> ";
}
}
echo "</td></tr></table>"; CloseTable();
include("footer.php");
}
во вложении находится 2-й вариант с полным кодом. если вам легче работать с оригиналом, я его сразу же сброшу
спасибо
raucher
|
|