PHP Scripting Forums » PHP Classes Support Forum » MyPagina class Support forum

How to change numbering of pages

(4 posts)
Please support us by buying these products:

  1. User has not uploaded an avatar

    dewchugr
    Member

    Thanks for the great script.

    I would like to change the way the script numbers so that the first page is 1 instead of 0 and second page is number 2, etc. I am only concerned with the links that are passed and the way they are shown in the status bar.

    If I could increase the page numbers in the links by one and then reduce them when the page reloads it would do what I want.

    Could you tell me where I would need to modify the code to do this?

    Posted 9 months ago #
  2. Hi,

    you need to change this two functions:

    function set_page() {
    		$page = (!empty($_REQUEST[$this->get_var])) ? (int)$_REQUEST[$this->get_var] : 1;
    		return $page;
    	}
    function get_page_result() {
    		$start = ($this->set_page()-1) * $this->rows_on_page;
    		$diff = $this->get_total_rows() - $start;
    		$end = ($diff < $this->rows_on_page) ? $diff : $this->rows_on_page;
    		$page_sql = sprintf("%s LIMIT %s, %s", $this->sql, $start, $end);
    		$this->result = mysql_query($page_sql);
    		return $this->result;
    	}
    Posted 9 months ago #
  3. User has not uploaded an avatar

    dewchugr
    Member

    Thanks for your quick response.

    I have made these changes, but it still isn't working correctly. When I load the page the number highlighted is 2 and all of the links still show one number lower than they should. I think I now need to increase the page number in the URLs by one.

    Thanks again for your help.

    Posted 9 months ago #
  4. I didn't tested the changed code, but it should give you an idea how it works.

    Actually I think the first doesn't need a number, the file name is a enough

    Posted 9 months ago #

RSS feed for this topic

Reply

You must log in to post.