Editing A Block To Display Page Numbers (Links)

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Editing A Block To Display Page Numbers (Links)
Pheonix
CZ Newbie
Pheonix has been a member for over 20 year's 20 Year Member
Gender: Male
Status: Offline
Joined: Apr 13, 2004
0.00 posts per day
Posts: 24
Points: 1,643
   
hey im just wondering if it would be possible to display page numbers ie. 1, 2, 3 if for instance the post had 3 posts and when clicking on that coresponding number it link to that page of the post. rather than just clicking the link and it directing to the 1st page and you having to weed through the rest. also if there is only 1 page have it display no extra numbers as clicling the link obviously bring u to the first page. ie. exactly how the viewforum.php works but in a front center block. heres the block:



<?php

##############################################################################
# PHP-Nuke Block: ClanMtS Center Forum Block v.1.0                        #
# Made for PHP-Nuke 6.5 & up                               #
# Made by mtechnik http://www.mtechnik.net                                   #
# Original script from [ Register or login to view links on this board. ] (I just changed it to fit the theme) #
# This block is made only to match the SimpleTech Theme pack                 #
##############################################################################
# This program is free software. You can redistribute it and/or modify       #
# it under the terms of the GNU General Public License as published by       #
# the Free Software Foundation; either version 2 of the License.             #
# If you modify this, let me know for fun. =)                                #
############################################################################## 

if (eregi("block-ClanMtS-Forum.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
   
global $prefix, $dbi, $sitename, $admin;

$HideViewReadOnly = 1;
          
$Last_New_Topics  = 10;
$show = "  <tr>
    <td height=\"28\" colspan=\"6\" align=\"center\" class=\"catbottom\">&nbsp;</td>
  </tr>
</table></td>
        </tr>
      </table></td>
  </tr>
</table>";

$Count_Topics = 0;
$Topic_Buffer = "";
$result = sql_query( "SELECT topic_id, forum_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies, topic_moved_id FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC", $dbi );
while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = sql_fetch_row( $result, $dbi ) )

{
   $skip_display = 0;
   if( $HideViewReadOnly == 1 )
   {
      $result1 = sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'", $dbi );
      list( $auth_view, $auth_read ) = sql_fetch_row( $result1, $dbi );
      if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
   }

   if( $topic_moved_id != 0 )
   {
     // Shadow Topic !!
      $skip_display = 1;
   }
   
   if( $skip_display == 0 )
   {
     $Count_Topics += 1;

$result2 = sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$topic_poster'", $dbi);
list($username, $user_id)=sql_fetch_row($result2, $dbi);
$avtor=$username;
$sifra=$user_id;

$result3 = sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%m/%d/%Y at %H:%i') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'", $dbi);
list($poster_id, $post_time)=sql_fetch_row($result3, $dbi);

$result4 = sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'", $dbi);
list($username, $user_id)=sql_fetch_row($result4, $dbi);

                         $viewlast .="  <tr>
    <td height=\"30\" nowrap class=\"row2\"><img src=\"images/folder_new.gif\" border=\"0\" /></td>
    <td width=\"100%\" class=\"row2\" onMouseOver=this.style.backgroundColor=\"$bgcolor1\" onMouseOut=this.style.backgroundColor=\"$bgcolor2\"  onclick=\"window.location.href='modules.php?name=Forums&file=viewtopic&t=$topic_id#$topic_last_post_id'\">&nbsp;<a href=\"modules.php?name=Forums&file=viewtopic&t=$topic_id#$topic_last_post_id\">$topic_title</a></td>
    <td align=\"center\" class=\"row2\">$topic_replies</td>
    <td align=\"center\" class=\"row2\"><a href=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$sifra\">$avtor</a></td>
    <td align=\"center\" class=\"row2\">$topic_views</td>
    <td align=\"center\" nowrap class=\"row2\"><font size=\"-2\"><i>&nbsp;&nbsp;$post_time&nbsp;</i></font><br>
      <a href=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$user_id\">$username</a>&nbsp;<a href=\"modules.php?name=Forums&file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"></a><img src=\"images/icon_minipost_new.gif\" border=\"0\" alt=\"View Latest Post\"></a></td>
  </tr>";
}
   
   if( $Last_New_Topics == $Count_Topics ) { break 1; }
   
}

    $content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" class=\"tableicon\">
  <tr>
    <td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
        <tr>
          <td class=\"row3\"><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">
  <tr>
    <th height=\"25\" colspan=\"2\" align=\"center\" nowrap class=\"row3\"><font color=\"#CCCCCC\"><strong>Topics</strong></font></th>
    <th width=\"40\" align=\"center\" nowrap class=\"row3\"><font color=\"#CCCCCC\"><strong>&nbsp;Replies&nbsp;</strong></font></th>
    <th width=\"70\" align=\"center\" nowrap class=\"row3\"><font color=\"#CCCCCC\"><strong>&nbsp;Author&nbsp;</strong></font></th>
    <th width=\"40\" align=\"center\" nowrap class=\"row3\"><font color=\"#CCCCCC\"><strong>&nbsp;Views&nbsp;</strong></font></th>
    <th align=\"center\" nowrap class=\"row3\"><font color=\"#CCCCCC\"><strong>&nbsp;Last Post&nbsp;</strong></font></th>
  </tr>";
    $content .= "$viewlast";

$content .= "$show";

?>



Back to top Reply with quote
#2   
Telli
Site Admin
Telli has been a member for over 20 year's 20 Year Member
Occupation: Self Employed
Age: 45
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.06 posts per day
Posts: 8089
Points: 494,430
   
If your reffering to when the link is clicked it goes directly to that post then the block is allready setup to do that.

modules.php?name=Forums&file=viewtopic&t=$topic_id#$topic_last_post_id

Is it not working for you?




_________________
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
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