Page Numbers For PhpNUke 7.3

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Page Numbers For PhpNUke 7.3
samy
CZ Newbie
samy has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Sep 01, 2004
0.00 posts per day
Posts: 26
Points: 1,670
   
i really need this module but the one coded for nuke 7.0 wont work on nuke 7.3
and is there somewere updated version of it? i really need it or maybe some other hack/module/block/ plz help! thx!

Example, what you'll see when you are on the first News page of 117 stories with 'Stories Number in Home' in Admin/Preferences set to 10:


117 Stories (12 Pages, 10 Per Page)
[ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 ] =>



Back to top Reply with quote
#2   re: Page Numbers For PhpNUke 7.3
CStingray78
CZ Super Newbie
CStingray78 has been a member for over 20 year's 20 Year Member
usa.gif maryland.gif
Occupation: IT Consultant
Age: 43
Gender: Male
Website:
Status: Offline
Joined: Dec 24, 2003
0.01 posts per day
Posts: 58
Points: 4,878
AIM Address   
I have the Pages Mod working on my 7.3 site on my homepage. I have edited a default /modules/Nems/index.php file and edited the 'theindex' function to what is shown below. If you need help finding the edits, please let me know.

function theindex($new_topic=0) {
    global $db, $storyhome, $topicname, $topicimage, $topictext, $datetime, $user, $cookie, $nukeurl, $prefix, $multilingual, $currentlang, $articlecomm, $sitename, $user_news, $pagenum;
    if ($multilingual == 1) {
   $querylang = "AND (alanguage='$currentlang' OR alanguage='')";
    } else {
   $querylang = "";
    }
    include("header.php");
    automated_news();
    if (isset($cookie[3]) AND $user_news == 1) {
   $storynum = $cookie[3];
    } else {
   $storynum = $storyhome;
    }
    if ($new_topic == 0) {
   $qdb = "WHERE (ihome='0' OR catid='0')";
   $home_msg = "";
    } else {
   $qdb = "WHERE topic='$new_topic'";
   $result_a = $db->sql_query("SELECT topictext FROM ".$prefix."_topics WHERE topicid='$new_topic'");
   $row_a = $db->sql_fetchrow($result_a);   
   $numrows_a = $db->sql_numrows($result_a);
   $topic_title = $row_a['topictext'];
   OpenTable();
   if ($numrows_a == 0) {
       echo "<center><font class=\"title\">$sitename</font><br><br>"._NOINFO4TOPIC."<br><br>[ <a href=\"modules.php?name=News\">"._GOTONEWSINDEX."</a> | <a href=\"modules.php?name=Topics\">"._SELECTNEWTOPIC."</a> ]</center>";
   } else {
       echo "<center><font class=\"title\">$sitename: $topic_title</font><br><br>"
      ."<form action=\"modules.php?name=Search\" method=\"post\">"
      ."<input type=\"hidden\" name=\"topic\" value=\"$new_topic\">"
      .""._SEARCHONTOPIC.": <input type=\"name\" name=\"query\" size=\"30\"> ;; ;;"
      ."<input type=\"submit\" value=\""._SEARCH."\">"
      ."</form>"
      ."[ <a href=\"index.php\">"._GOTOHOME."</a> | <a href=\"modules.php?name=Topics\">"._SELECTNEWTOPIC."</a> ]</center>";
   }
   CloseTable();
   echo "<br>";
    }
#    $result = $db->sql_query("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");

# start Page Numbers
    if ($pagenum == "") { $pagenum = 1 ; }
    $offset = ($pagenum-1) * $storynum ;
    $result = $db->sql_query("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");
# end Page Numbers


    while ($row = $db->sql_fetchrow($result)) {
   $s_sid = intval($row['sid']);
   $catid = intval($row['catid']);
   $aid = $row['aid'];
   $title = $row['title'];
   $time = $row['time'];
   $hometext = $row['hometext'];
   $bodytext = $row['bodytext'];
   $comments = $row['comments'];
   $counter = $row['counter'];
   $topic = $row['topic'];
   $informant = $row['informant'];
   $notes = $row['notes'];
   $acomm = intval($row['acomm']);
   $score = intval($row['score']);
   $ratings = intval($row['ratings']);
   if ($catid > 0) {
       $row2 = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_stories_cat WHERE catid='$catid'"));
       $cattitle = $row2['title'];
   }
   getTopics($s_sid);
   formatTimestamp($time);
   $subject = stripslashes($subject);
   $hometext = stripslashes($hometext);
   $notes = stripslashes($notes);
   $introcount = strlen($hometext);
   $fullcount = strlen($bodytext);
   $totalcount = $introcount + $fullcount;
   $c_count = $comments;
   $r_options = "";
      if (isset($cookie[4])) { $r_options .= "&amp;mode=$cookie[4]"; }
      if (isset($cookie[5])) { $r_options .= "&amp;order=$cookie[5]"; }
      if (isset($cookie[6])) { $r_options .= "&amp;thold=$cookie[6]"; }
   $story_link = "<a href=\"modules.php?name=News&amp;file=article&amp;sid=$s_sid$r_options\">";
   $morelink = "(";
   if ($fullcount > 0 OR $c_count > 0 OR $articlecomm == 0 OR $acomm == 1) {
       $morelink .= "$story_link<b>"._READMORE."</b></a> | ";
   } else {
       $morelink .= "";
   }
   if ($fullcount > 0) { $morelink .= "$totalcount "._BYTESMORE." | "; }
   if ($articlecomm == 1 AND $acomm == 0) {
       if ($c_count == 0) { $morelink .= "$story_link"._COMMENTSQ."</a>"; } elseif ($c_count == 1) { $morelink .= "$story_link$c_count "._COMMENT."</a>"; } elseif ($c_count > 1) { $morelink .= "$story_link$c_count "._COMMENTS."</a>"; }
   }
   $sid = intval($s_sid);
   if ($catid != 0) {
       $row3 = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_stories_cat WHERE catid='$catid'"));
       $title1 = $row3['title'];
       $title = "<a href=\"modules.php?name=News&amp;file=categories&amp;op=newindex&amp;catid=$catid\"><font class=\"storycat\">$title1</font></a>: $title";
       $morelink .= " | <a href=\"modules.php?name=News&amp;file=categories&amp;op=newindex&amp;catid=$catid\">$title1</a>";
   }
   if ($score != 0) {
       $rated = substr($score / $ratings, 0, 4);
   } else {
       $rated = 0;
   }
   $morelink .= " | "._SCORE." $rated";
   $morelink .= ")";
   $morelink = str_replace(" |  | ", " | ", $morelink);
   themeindex($aid, $informant, $datetime, $title, $counter, $topic, $hometext, $notes, $morelink, $topicname, $topicimage, $topictext);
    }

# Uncomment this next line and change 100 to whatever for number of stories in news and topics for Page Numbers section
    #$limitpn = "limit 100"; # limit number of stories
    $sql_pn = "select * from ".$prefix."_stories $qdb $querylang $limitpn";
    $result_pn = $db->sql_query($sql_pn);
    $numstories = $db->sql_numrows($result_pn);
    $numpages = ceil($numstories / $storynum);
    #if ($numpages > 1 and $new_topic == 0) {
    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&amp;new_topic=$new_topic&amp;pagenum=$prevpage\">";
                echo "<img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
            } else {
                echo "<a href=\"modules.php?name=News&amp;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&amp;new_topic=$new_topic&amp;pagenum=$i\">$i</a>";
                } else {
                    echo "<a href=\"modules.php?name=News&amp;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&amp;new_topic=$new_topic&amp;pagenum=$nextpage\">";
                echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
            } else {
                echo "<a href=\"modules.php?name=News&amp;pagenum=$nextpage\">";
                echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
            }
        }
        echo "</center>" ;
        closetable();
    }
#END Page Numbers in news and topics

    include("footer.php");
}


Also, don't forget to put these statements in your /modules/News/language/lang-yourlang.php
define("_STORIES","Stories");
define("_PAGES","Pages");
define("_PERPAGE","Per Page");


Then, edit /modules/News/categories.php and insert the followin replacement for the 'theindex' function:
function theindex($catid) {
    global $storyhome, $httpref, $httprefmax, $topicname, $topicimage, $topictext, $datetime, $user, $cookie, $nukeurl, $prefix, $multilingual, $currentlang, $db, $articlecomm, $module_name, $pagenum;
    if ($multilingual == 1) {
       $querylang = "AND (alanguage='$currentlang' OR alanguage='')"; /* the OR is needed to display stories who are posted to ALL languages */
    } else {
       $querylang = "";
    }
    include("header.php");
    if (isset($cookie[3])) {
   $storynum = $cookie[3];
    } else {
   $storynum = $storyhome;
    }
    $db->sql_query("update ".$prefix."_stories_cat set counter=counter+1 where catid='$catid'");
#    $result = $db->sql_query("SELECT sid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories where catid='$catid' $querylang ORDER BY sid DESC limit $storynum");

# start Page Numbers
    if ($pagenum == "") { $pagenum = 1 ; }
    $offset = ($pagenum-1) * $storynum ;
    $result = $db->sql_query("SELECT sid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories where catid='$catid' $querylang ORDER BY sid DESC limit $offset, $storynum");
# end Page Numbers

    while ($row = $db->sql_fetchrow($result)) {
   $s_sid = intval($row['sid']);
   $aid = $row['aid'];
   $title = $row['title'];
   $time = $row['time'];
   $hometext = $row['hometext'];
   $bodytext = $row['bodytext'];
   $comments = $row['comments'];
   $counter = $row['counter'];
   $topic = $row['topic'];
   $informant = $row['informant'];
   $notes = $row['notes'];
   $acomm = intval($row['acomm']);
   $score = intval($row['score']);
   $ratings = intval($row['ratings']);
   getTopics($s_sid);
   formatTimestamp($time);
   $subject = stripslashes($subject);
   $hometext = stripslashes($hometext);
   $notes = stripslashes($notes);
   $introcount = strlen($hometext);
   $fullcount = strlen($bodytext);
   $totalcount = $introcount + $fullcount;
   $c_count = $comments;
   $r_options = "";
      if (isset($cookie[4])) { $r_options .= "&amp;mode=$cookie[4]"; }
      if (isset($cookie[5])) { $r_options .= "&amp;order=$cookie[5]"; }
      if (isset($cookie[6])) { $r_options .= "&amp;thold=$cookie[6]"; }
   $story_link = "<a href=\"modules.php?name=News&amp;file=article&amp;sid=$s_sid$r_options\">";
   $morelink = "(";
   if ($fullcount > 0 OR $c_count > 0 OR $articlecomm == 0 OR $acomm == 1) {
       $morelink .= "$story_link<b>"._READMORE."</b></a> | ";
   } else {
       $morelink .= "";
   }
   if ($fullcount > 0) { $morelink .= "$totalcount "._BYTESMORE." | "; }
   if ($articlecomm == 1 AND $acomm == 0) {
       if ($c_count == 0) { $morelink .= "$story_link"._COMMENTSQ."</a>"; } elseif ($c_count == 1) { $morelink .= "$story_link$c_count "._COMMENT."</a>"; } elseif ($c_count > 1) { $morelink .= "$story_link$c_count "._COMMENTS."</a>"; }
   }
   if ($score != 0) {
       $rated = substr($score / $ratings, 0, 4);
   } else {
       $rated = 0;
   }
   $morelink .= " | "._SCORE." $rated";
   $morelink .= ")";
   $morelink = str_replace(" |  | ", " | ", $morelink);
   $sid = intval($s_sid);
   $row2 = $db->sql_fetchrow($db->sql_query("select title from ".$prefix."_stories_cat where catid='$catid'"));
   $title1 = $row2['title'];
   
   $title = "$title1: $title";
   themeindex($aid, $informant, $datetime, $title, $counter, $topic, $hometext, $notes, $morelink, $topicname, $topicimage, $topictext);
    }
    if ($httpref==1) {
   $referer = $_SERVER["HTTP_REFERER"];
   if ($referer=="" OR ereg("unknown", $referer) OR eregi($nukeurl,$referer)) {
   } else {
       $db->sql_query("insert into ".$prefix."_referer values (NULL, '$referer')");
   }
   $numrows = $db->sql_numrows($db->sql_query("select * from ".$prefix."_referer"));
   if($numrows==$httprefmax) {
           $db->sql_query("delete from ".$prefix."_referer");
   }
    }

#START Page Numbers

    # Uncomment this next line and change 100 to whatever for number of stories in categories for Page Numbers section
    #$limitpn = "limit 100"; # limit number of stories in categories

    $numstories = $db->sql_numrows($db->sql_query("select * from ".$prefix."_stories where catid='$catid' $querylang $limitpn"));
    $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" ;
            echo "<a href=\"modules.php?name=News&amp;file=categories&amp;op=newindex&amp;catid=$catid&amp;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 {
                echo "<a href=\"modules.php?name=News&amp;file=categories&amp;op=newindex&amp;catid=$catid&amp;pagenum=$i\">$i</a>";
            }
            if ($i < $numpages) { echo " | "; } else { echo " ]"; }
        }
        if ($pagenum < $numpages) {
            $nextpage = $pagenum + 1 ;
         $rightarrow = "images/right.gif" ;
            echo "<a href=\"modules.php?name=News&amp;file=categories&amp;op=newindex&amp;catid=$catid&amp;pagenum=$nextpage\">";
            echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
        }
        echo "</center>" ;
        closetable();
    }
#END Page Numbers in categories

    include("footer.php");
}


Hope this helps!
Tom



_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#3   re: Page Numbers For PhpNUke 7.3
samy
CZ Newbie
samy has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Sep 01, 2004
0.00 posts per day
Posts: 26
Points: 1,670
   
MAN U R GOD! I MEEN IT THANX ALOT BRO I OWN U MY LIFE icon_smile.gif)))))

i apreceate it alot it edited links ALLOVERRRR were i needed on topics / news / main page and so on!!! thx alot!!! icon_smile.gif)

only 1 question is there a way 2 put this hack in UP before the 1st post so people can see it?



Back to top Reply with quote
#4   re: Page Numbers For PhpNUke 7.3
tigakor
CZ Newbie
tigakor has been a member for over 19 year's 19 Year Member
australia.gif
Gender: Male
Website:
Status: Offline
Joined: Feb 17, 2005
0.00 posts per day
Posts: 4
Points: 189
   
Just wanted to bump this thread up a little..

I'm running nuke 7.6 and found that the 7.3 code works well for me so I thought
it might work for someone else who maybe looking



Back to top Reply with quote
#5   
yanger
CZ Super Newbie
yanger has been a member for over 18 year's 18 Year Member
Gender: Male
Status: Offline
Joined: Apr 27, 2006
0.00 posts per day
Posts: 33
Points: 918
   
guys please help... i tried using it too and now i get this error whenever i try to access my site.

Parse error: parse error, unexpected $ in /home/naga/public_html/modules/News/index.php on line 363



Back to top Reply with quote
#6   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Attach your modules/News/index.php.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#7   re: Page Numbers For PhpNUke 7.3
yanger
CZ Super Newbie
yanger has been a member for over 18 year's 18 Year Member
Gender: Male
Status: Offline
Joined: Apr 27, 2006
0.00 posts per day
Posts: 33
Points: 918
   
Dear Telli thank you soooo very much for trying to help me here... i really need this page number thingie on my site and i can't do it... here i am attaching my index.php along with this post. The index is as it is... with no changes... since i got the error i haven't added the page number hack on it. i downloaded it directly from my site and attaching it here.



Attached Files
index.rar (2.62 KB, Downloaded: 5232 Time(s))


Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum