Results 1 to 7 of 7
  1. #1
    Casual Pligger eH9116's Avatar
    Joined
    Jan 2007
    Posts
    47
    Thanks
    Received:0
    Given: 0

    Displaying #'s of viewed articles MOD

    Hey guys, I was just working on another feature that I wanted to be implemented and thought I would share. Add the red text to "libs\html1.php" between the blue lines to show the currently viewed article numbers. Example: "Showing 1-10 of 17" or "Showing 2-17 of 17". Enjoy!


    ......
    echo '<div class="pagination"><p>';

    $from=$current*10-9;
    if($total<$current*10) {
    $to=$total;
    }
    else {
    $to=$current*10;
    }
    echo '<b><h3>Showing '.$from.'-'.$to.' of '.$total.'</h3></b><br>';


    if($current==1) {
    .......
    my pligg site: http://strandalo.us
    Attached Images Attached Images

  2. #2
    Constant Pligger disier's Avatar
    Joined
    Nov 2006
    Posts
    123
    Thanks
    Received:0
    Given: 0
    very nice you did a good work with this.

  3. #3
    Casual Pligger eH9116's Avatar
    Joined
    Jan 2007
    Posts
    47
    Thanks
    Received:0
    Given: 0

    Update!

    hey guys, here's an update to my previous code. Before, when you viewed the "Top Users" page it displayed the numbers incorrectly. Edit the file "libs/html1.php" as instructed above but instead add the following in the do_pages() function:

    Code:
    	if($thepage == '/topusers.php') {
    		$pagel=25;
    	}
    	else {
    		$pagel=10;
    	}
    	$from=$current*$pagel-($pagel-1);
    	if($total<$current*$pagel) {
    		$to=$total;
    	}
    	else {
    		$to=$current*$pagel;
    	}
    	echo '<b><h3>Showing '.$from.'-'.$to.' of '.$total.'</h3></b><br>';


    Enjoy! Now people have an idea of the total scope of your site including stories and users!

  4. #4
    Casual Pligger move55's Avatar
    Joined
    Feb 2007
    Posts
    30
    Thanks
    Received:0
    Given: 0
    hi

    i have just added the feature but and got the message:

    " Showing 31-29 of 29 "
    i guess the way you calculate the total is not quite correct.

    pls review

  5. #5
    Casual Pligger eH9116's Avatar
    Joined
    Jan 2007
    Posts
    47
    Thanks
    Received:0
    Given: 0
    are you sure you put it in function do_pages() ? Because I have gone through the code several times now and have not had a problem. If all has checked out, what page were you on when it displayed that? I even have 49 (ending in a '9') articles on my site right now and the last page displays "Showing 41-49 of 49".

    site: http://strandalo.us

  6. #6
    Pligg Donor dennis's Avatar
    Joined
    Dec 2007
    Posts
    12
    Thanks
    Received:0
    Given: 0
    nice mod--here's a tip:

    make sure that the number of stories displayed, is aligned with the integer '10'.

    in other words, on my site (reliablesource.org), the number of stories is 8. so the algorithm on my site looks like:

    $from=$current*8-7;
    if($total<$current*8) {
    $to=$total;
    }
    else {
    $to=$current*8;
    }


    Quote Originally Posted by eH9116 View Post
    are you sure you put it in function do_pages() ? Because I have gone through the code several times now and have not had a problem. If all has checked out, what page were you on when it displayed that? I even have 49 (ending in a '9') articles on my site right now and the last page displays "Showing 41-49 of 49".

    site: Strandalo.us / All

  7. #7
    Pligg Donor scotjam's Avatar
    Joined
    Jan 2008
    Posts
    10
    Thanks
    Received:0
    Given: 0
    This is very useful.

    Is it possible to place 'Showing X-Y of Z' inside the same grey box with the '<< previous' and 'next >>' buttons?

    I'd prefer to have it indented on the left hand side and not on the right side side. P.S. I'm sure its very simple, but I don't know how.

Similar Threads

  1. [SOLVED] How can i change 8 articles to 16 articles in pligg?
    By Fred007 in forum Questions & Comments
    Replies: 33
    Last Post: 11-09-2008, 03:52 AM
  2. Category only viewed when logged in
    By Dionysus in forum Questions & Comments
    Replies: 1
    Last Post: 08-31-2007, 02:28 PM
  3. Replies: 3
    Last Post: 08-08-2007, 12:13 AM
  4. last viewed by
    By wwwSENSERELYcom in forum Questions & Comments
    Replies: 0
    Last Post: 05-26-2007, 04:47 PM
  5. You last viewed...
    By Geoserv in forum Questions & Comments
    Replies: 7
    Last Post: 04-13-2007, 03:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Pligg Modules and Pligg Templates from Pligg Pro Web Hosting Services by Midphase Dreamhost Web Hosting Donate to Pligg