Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 08-27-2008, 09:21 AM   #1 (permalink)
Dan
Recruit
 
Join Date: Aug 2008
Posts: 1
Dan is on a distinguished road
Help with some coding

What I want to do, is get the exact number of posts which should be on a page if it's the last page of a thread. I have the page length, I have the number of pages and I have the total number of posts in a thread. Now what I'm doing is this following bit of code:
(page * PageLength <= ThreadPostCount ? PageLength : ThreadPostCount - (page - 1) * PageLength);

Pretty much, if the total number of posts to the end of this page(page * page length) are less than or equal the length of the thread, I use the given pagelength. If not I subtract the number of posts on pages preceding this page and subtracting it from the total length, to get the exact number to display.

I'm sure that there is an easier approach I just can't think of it.
Dan is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mudding And coding. DiaBoliK Standard C, C++ 3 01-23-2005 11:36 AM
what to drink while coding saline Lounge 24 03-05-2003 11:45 PM


All times are GMT -8. The time now is 06:50 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting