Haberler (News) modülüne sayfa numaralandırma ekleme
1- modules/News/language/lang-turkish.php dosyasını açın ve ?>
satırından önce aşağıdakileri ekleyin.
Kod |
define("_STORIES","Haber");
define("_PAGES","Sayfa");
define("_PERPAGE","Her sayfada");
|
2- modules/News/index.php dosyasını açın. function theindex($new_topic="0")
{ yazan yerde global ile başlayan satıra $pagenum ekleyin.
Örneğin;
Kod |
global $db, $storyhome, $topicname, $topicimage, $topictext,
$datetime, $user, $cookie, $nukeurl, $prefix, $multilingual, $currentlang,
$articlecomm, $sitename, $user_news, $userinfo;
|
yazan yeri
Kod |
global $db, $storyhome, $topicname, $topicimage, $topictext,
$datetime, $user, $cookie, $nukeurl, $prefix, $multilingual, $currentlang,
$articlecomm, $sitename, $user_news, $userinfo,
$pagenum;
|
haline getireceksiniz.
3- Aynı dosyada;
Kod |
$sql = "SELECT sid, catid, aid, title, time,
hometext, bodytext, comments, counter, topic, informant, notes, acomm,
score, ratings FROM ".$prefix."_stories $qdb $querylang ORDER BY sid DESC
limit $storynum";
|
yazan yeri bulun ve aşağıdaki ile değiştirin.
Kod |
if ($pagenum == "") { $pagenum = 1 ; }
$offset = ($pagenum-1) * $storynum ;
$sql = "SELECT sid, catid, aid, title, time, hometext, bodytext, comments,
counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories
$qdb $querylang ORDER BY sid DESC limit $offset, $storynum";
|
4- Aynı dosyada;
Kod |
themeindex($aid, $informant, $datetime, $title, $counter,
$topic, $hometext, $notes, $morelink, $topicname, $topicimage, $topictext);
}
include("footer.php");
|
yazan yeri bulun ve include("footer.php"); satırından önceye aşağıdaki
kodları ekleyin.
Kod |
#START Page Numbers
#$limitpn = "limit 100"; # limit number of stories
if(isset($new_topic)) {
$sql_pn = "select * from ".$prefix."_stories where topic='$new_topic' $limitpn";
} else {
$sql_pn = "select * from ".$prefix."_stories where ihome=0 $limitpn";
}
$result_pn = $db->sql_query($sql_pn);
$numstories = $db->sql_numrows($result_pn);
$numpages = ceil($numstories / $storynum);
if ($numpages > 1) {
opentable();
echo "<center>$numstories "._STORIES." ($numpages "._PAGES.", $storynum
"._PERPAGE.")<br>" ;
if ($pagenum > 1) {
$prevpage = $pagenum - 1 ;
$leftarrow = "images/left.gif" ;
if(isset($new_topic)) {
echo "<a href=\"modules.php?name=News&new_topic=$new_topic&pagenum=$prevpage\">";
echo "<img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
} else {
echo "<a href=\"modules.php?name=News&pagenum=$prevpage\">";
echo "<img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
}
}
echo "[ " ;
for ($i=1; $i < $numpages+1; $i++) {
if ($i == $pagenum) {
echo "<b>$i</b>";
} else {
if(isset($new_topic)) {
echo "<a href=\"modules.php?name=News&new_topic=$new_topic&pagenum=$i\">$i</a>";
} else {
echo "<a href=\"modules.php?name=News&pagenum=$i\">$i</a>";
}
}
if ($i < $numpages) { echo " | "; } else { echo " ]"; }
}
if ($pagenum < $numpages) {
$nextpage = $pagenum + 1 ;
$rightarrow = "images/right.gif" ;
if(isset($new_topic)) {
echo "<a href=\"modules.php?name=News&new_topic=$new_topic&pagenum=$nextpage\">";
echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
} else {
echo "<a href=\"modules.php?name=News&pagenum=$nextpage\">";
echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
}
}
echo "</center>" ;
closetable();
}
#END Page Numbers in news and topics
|
Eklendiği Tarih: 2006-06-20 13:12:16 || Okuma: 13399
|