1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Page navigation

Discussion in 'Development Tutorials [Archive]' started by g0rn, Oct 6, 2010.

  1. g0rn

    g0rn Well-Known Member

    This is a simple add-on that creates "/pagenav" page with sample <xen:pagenav> tag so you can see how to use pagenavs in your add-ons.
    <xen:pagenav> uses the following syntax:
    HTML:
    <xen:pagenav link="pagenav" page="{$page}" perpage="{$itemsPerPage}" total="{$totalItems}" />
    where:
    $page is current page number
    $itemsPerPage is a number of items shown on one page
    $totalItems is a number of items on all pages
    Inside the controller you can get current page number by using
    PHP:
    $page $this->_input->filterSingle('page'XenForo_Input::UINT);
    It gets 'page' parameter from the URL and filters it to ensure it is an unsigned integer. Then you can pass $page to the model to get results you want.

    To install this add-on copy PageNavigation folder to your library folder and import the xml file. You can access that sample page by pointing your browser to http://your-xenforo-installation/pagenav (or http://your-xenforo-installation/index.php?pagenav if you have SEO friendly URLs disabled).
     

    Attached Files:

    Hugilore111, Valhalla, Marc and 6 others like this.
  2. Floris

    Floris Guest

    Excellent work :)
     

Share This Page