Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Goto page: 1 - 2 [+1]

Bottom
Help with the Pager
  • Posted: 07.12.2005, 02:09
     
    randomblink
    rank:
    Helper Helper
    registered:
     February 2003
    Status:
    offline
    last visit:
    06.03.08
    Posts:
    233
    Ok...
    If you go to: FrankPage dot net
    You will see that his comics on the main page have a HUGE-ass pager.
    How could I shorten that down...?
    I would be happy with something that looked like:

    <- 1, 2, 3, ... ... 19, 20, 21 ->

    Can someone help me with this?

    --
    That was a hell of a thing...
    -------------------------------------
    Galaxy Quest
  • Posted: 07.12.2005, 03:52
     
    ainigma32
    rank:
    Professional Professional
    registered:
     January 2004
    Status:
    offline
    last visit:
    22.03.06
    Posts:
    958
    You could check out the pager that comes with Pagesetter (in the plugin folder). I think that does what you're looking for. You would have to tweak it to work with pnComic (?)
  • Posted: 07.12.2005, 07:26
     
    randomblink
    rank:
    Helper Helper
    registered:
     February 2003
    Status:
    offline
    last visit:
    06.03.08
    Posts:
    233
    I believe that there is a setting I can set that will do what I want, I just can't find it in documentation anywhere...
    I would rather NOT install an entirely new module just to get the pager to work...
    Thanks for the idea tho...

    --
    That was a hell of a thing...
    -------------------------------------
    Galaxy Quest
  • Posted: 07.12.2005, 08:05
     
    cannibus
    rank:
    Helper Helper
    registered:
     November 2004
    Status:
    offline
    last visit:
    20.09.08
    Posts:
    401
    look @ the pager plugin in pnRender module, i think thats the one that pnCZomics use. it comes with PN
  • Posted: 07.12.2005, 13:48
     
    ainigma32
    rank:
    Professional Professional
    registered:
     January 2004
    Status:
    offline
    last visit:
    22.03.06
    Posts:
    958
    Actually I meant you could take the Smarty plugin from Pagesetter and tweak it. That would mean just one extra file: the custom pager plugin.

    I've looked at the pager that comes with pnRender (/modules/pnRender/plugins/function.pager.php) and I can't find a settings that will constrain the number of pages shown.
    There is a parameter named $limit but changing it doesn't seem to do anything.

    Maybe drak can offer some more info since he's the last who modified the pager file?
  • Posted: 08.12.2005, 01:20
     
    randomblink
    rank:
    Helper Helper
    registered:
     February 2003
    Status:
    offline
    last visit:
    06.03.08
    Posts:
    233
    These are all good ideas... But they unfortunately are not what I am looking for... I KNOW that the current Pager running can do what I want... I have been thru the CORE modules and plugins looking for pager information, but I find nothing to help me with this situation, altho I still believe there is an answer...

    Hopefully, someone will read this and know the answer and supply it... THAT would be amazingly wonderful... meanwhile, I will keep digging and testing other ideas... I just am hoping that my friends site doesn't end up with 4 lines of pager crap, chuckle...

    --
    That was a hell of a thing...
    -------------------------------------
    Galaxy Quest
  • Posted: 08.12.2005, 01:59
     
    cannibus
    rank:
    Helper Helper
    registered:
     November 2004
    Status:
    offline
    last visit:
    20.09.08
    Posts:
    401
    wha i was saying was look into the pager file and change it.

    something along the lines of

    Code

    if (pagenum > 12)
    {
      print out the first 3 pages, then print "..." and then print the last page
    }


    i need to do this as well for my site, but it was never that high in my to do list.

    will see if i wanna do it at some point tonight
  • Posted: 08.12.2005, 02:58
     
    cannibus
    rank:
    Helper Helper
    registered:
     November 2004
    Status:
    offline
    last visit:
    20.09.08
    Posts:
    401
    ok. iits a lil more complicated than i thought, when i see how the pager works.

    what the pager does is KIND of what u want.

    it does something like:

    <- 1, 31, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 71, 91 ->

    this is what i gonna try do:
    <- 1, 2, 3, ... 14, 15, 16, 17, 18, 19, 20 ... 89, 90, 91 ->


    ima work on it some point this week, cant guarentee. i got some other stuff i gotta do of more importance
  • Posted: 08.12.2005, 10:36
     
    Slugger
    rank:
    Professional Professional
    registered:
     March 2003
    Status:
    offline
    last visit:
    13.08.06
    Posts:
    1185
    Hmmm... a count of x number of results. Now, to reduce the number of links we can increase the number of results per page or keep the results/page constant and set an upper value for the number of links. Something needs to be constant. I prefer the latter so I wonder what is an acceptable number of links?

    I like the way this forum pages after a search for, say, pnRender:

    Goto page 1, 2, 3 ... 41, 42, 43 Next

    Slugger
  • Posted: 08.12.2005, 11:40
     
    cannibus
    rank:
    Helper Helper
    registered:
     November 2004
    Status:
    offline
    last visit:
    20.09.08
    Posts:
    401
    thats the problem with the pager, i noticed it isnnt really constant with how the page numbers are displayed.
  • Posted: 10.12.2005, 07:50
     
    Slugger
    rank:
    Professional Professional
    registered:
     March 2003
    Status:
    offline
    last visit:
    13.08.06
    Posts:
    1185
    Had a few minutes today and decided I'd take a crack at it. Turned out not to be such a big deal. Hopefully, the devs will agree and fix this for posterity. Anyway, I'm happy to say that now the pager for my news stories doesn't go on, and on, and on, and on, and on, and on... like it used to. :D

    BTW the pager for the news stories is pnHTML...yuck! :( It can be found in includes/pnHTML.php

    Take care all.

    Slugger
  • Posted: 12.12.2005, 19:55
     
    randomblink
    rank:
    Helper Helper
    registered:
     February 2003
    Status:
    offline
    last visit:
    06.03.08
    Posts:
    233
    How do we make it work, oh slugger of great coding-ness...?

    --
    That was a hell of a thing...
    -------------------------------------
    Galaxy Quest
  • Posted: 13.12.2005, 06:36
     
    Slugger
    rank:
    Professional Professional
    registered:
     March 2003
    Status:
    offline
    last visit:
    13.08.06
    Posts:
    1185

    randomblink

    How do we make it work, oh slugger of great coding-ness...?


    Hardly...LOL...I just modified the code from PNphpBB2 because I liked the way it looked. As you can tell, I didn't even bother cleaning up the math.

    OK, here's what I did but beware, cause it's a core hack and we know that can be a problem so, backup the file, and use at your own risk. :wink:

    Go to pnHTML.php in your includes directory and find:

    Code

    // Show startnum link
            if ($startnum != 1) {
                $url = preg_replace('/%%/', 1, $urltemplate);
                $compoutput->URL($url, '<<');
            } else {
                $compoutput->Text('<<');
            }
            $compoutput->Text(' ');

            // Show following items
            $pagenum = 1;

            $compoutput->Text(' | ');
            for ($curnum = 1; $curnum <= $total; $curnum += $perpage) {
                if (($startnum < $curnum) || ($startnum > ($curnum + $perpage - 1))) {
                    //mod by marsu - use sliding window for pagelinks
                    if ((($pagenum%10)==0) // link if page is multiple of 10
                            || ($pagenum==1) // link first page
                            || (($curnum >($startnum-4*$perpage)) //link -3 and +3 pages
                            &&($curnum <($startnum+4*$perpage)))
                    ) {
                    // Not on this page - show link
                    $url = preg_replace('/%%/', $curnum, $urltemplate);
                    $compoutput->URL($url, $pagenum);
                    $compoutput->Text(' | ');
                    }
                    //end mod by marsu
                } else {
                    // On this page - show text
                    $compoutput->Text($pagenum.' ');
                    $compoutput->Text(' | ');
                }
                $pagenum++;
            }
            if (($curnum >= $perpage + 1) && ($startnum < $curnum - $perpage)) {
                $url = preg_replace('/%%/', $curnum - $perpage, $urltemplate);
                $compoutput->URL($url, '>>');
            } else {
                $compoutput->Text('>>');
            }


    Replace it with

    Code

    $total_pages = ceil($total/$perpage);
       
        $on_page = floor(($startnum -1) / $perpage) + 1;
       
        if ( $on_page > 1 )
        {
            $curnum = ( ( $on_page - 2 ) * $perpage ) +1 ;
            $url = preg_replace('/%%/', $curnum, $urltemplate);
            $compoutput->URL($url, '<<');
            $compoutput->Text(' ');
        }
       
        if ( $total_pages > 10 )
        {
            $init_page_max = ( $total_pages > 3 ) ? 3 : $total_pages;

            for($i = 1; $i < $init_page_max + 1; $i++)
            {          
                if($i == $on_page) {
                    $compoutput->Text($i);
                } else {
                    $curnum = ( ( $i - 1 ) * $perpage ) + 1;
                    $url = preg_replace('/%%/', $curnum, $urltemplate);
                    $compoutput->URL($url, $i);
                }
                   
                if ( $i <  $init_page_max )
                {
                    $compoutput->Text(', ');
                }
            }

            if ( $total_pages > 3 )
            {
                if ( $on_page > 1  && $on_page < $total_pages )
                {
                    $page_string = ( $on_page > 5 ) ? ', ... ' : ', ';
                    $compoutput->Text($page_string);

                    $init_page_min = ( $on_page > 4 ) ? $on_page : 5;
                    $init_page_max = ( $on_page < $total_pages - 4 ) ? $on_page : $total_pages - 4;

                    for($i = $init_page_min - 1; $i < $init_page_max + 2; $i++)
                    {
                        if($i == $on_page) {
                            $compoutput->Text($i);
                        } else {
                            $curnum = ( ( $i - 1 ) * $perpage )+1;
                            $url = preg_replace('/%%/', $curnum, $urltemplate);
                            $compoutput->URL($url, $i);
                        }
                       
                        if ( $i <  $init_page_max + 1 )
                        {
                            $compoutput->Text(', ');
                        }
                    }

                    $page_string = ( $on_page < $total_pages - 4 ) ? ', ... ' : ', ';
                    $compoutput->Text($page_string);
                }
                else
                {
                    $compoutput->Text(', ... ');
                }

                for($i = $total_pages - 2; $i < $total_pages; $i++)
                {
                    if($i == $on_page) {
                        $compoutput->Text($i);
                    } else {
                        $curnum = ( ( $i - 1 ) * $perpage )+1;
                        $url = preg_replace('/%%/', $curnum, $urltemplate);
                        $compoutput->URL($url, $i);
                    }
                   
                    if( $i <  $total_pages - 1 )
                    {
                        $compoutput->Text(', ');
                    }
                }
            }
        }
        else
        {
            for($i = 1; $i < $total_pages; $i++)
            {
                if($i == $on_page) {
                    $compoutput->Text($i);
                } else {
                    $curnum = ( ( $i - 1 ) * $perpage )+1;
                    $url = preg_replace('/%%/', $curnum, $urltemplate);
                    $compoutput->URL($url, $i);
                }
               
                if ( $i <  $total_pages - 1 )
                {
                    $compoutput->Text(', ');
                }
            }
        }
       
        if ( $on_page < $total_pages - 1)
        {
            $curnum = ( $on_page * $perpage ) + 1;
            $url = preg_replace('/%%/', $curnum, $urltemplate);
           
            $compoutput->Text(' ');
            $compoutput->URL($url, '>>');
        }


    That's it! :)

    Slugger
  • Posted: 13.12.2005, 23:36
     
    jmvedrine
    rank:
    Professional Professional
    registered:
     January 2004
    Status:
    offline
    last visit:
    05.09.08
    Posts:
    633
    Buy Slugger, if I remember well pnComic is totally templated so it don"r uses pnhtml at all (I know it because I have a similar module phpcomic also pnRendered and older than pnComic and I looked at pnComic's code when it was released, in my opinion phpcomic has more features but of course as I am phpcomic developper, my opinion is biased)
    So as somebody already said, the file that randomblink beed to modify is modules/pnRender/plugins/function.pager.php
    Randomblink if you explain clearly and precisely what you want your pager to display (I hate to code something and after that hear "Wonderfull but I wanted that ...") I am on holidays next week so I would be more that happy to produce a customized function.randomblinkpager.php that can be used in any pnRendered module.
    Once this is done, you will only need to edit the modules/pnComics/pntemplates/pncomic_user_view.htm file
    and change the line

    Code

    <!--[pager  show="page" rowcount=$pager.numcomics limit=$pager.comics_per_page posvar=startnum shift=1]-->

    to:

    Code

    <!--[randomblinkpager  show="page" rowcount=$pager.numcomics limit=$pager.comics_per_page posvar=startnum shift=1]-->


    --
    Visit my live reef aquarium.

    My Amazon wish list.
  • Posted: 14.12.2005, 02:52
     
    randomblink
    rank:
    Helper Helper
    registered:
     February 2003
    Status:
    offline
    last visit:
    06.03.08
    Posts:
    233
    BEAUTIFUL!
    As for pnComic, I created it... and YES, it is completely Xanthia and pnRender ready... I have yet to add in more options... Of course if you would like to consider working together and putting out a complete package? I am willing to discuss it. I created pnComic because my friend (www.FrankPage.net) wanted to display his editorial comics on one of the sites he owned. (He works for a newspaper in NY and has a syndicated strip www.bobthesquirrel.com) So I looked everywhere, crashed my OWN site testing out some Comic Modules for PostNuke, and finally decided to create my own... Of course the experience with Module Design was worth the entire creation process itself... But in the meantime, Frank got his Editorial Comics a place to display...

    As for what I want it to do...?
    I just need the pager to produce out put looking like:
    <- 1, 2, 3, --- 19, 20, 21 ->

    He wants his users to be able to navigate through his comics, both recent and archival.
    And he doesn't want the pager to run more than one line.

    It would be WAY cool to have the pager have the option of replacing the <- and the -> with images through the pager attributes...
    But that is NOT necessary...

    I'm serious about working together. I would love to add more options to the pnComics thing.
    I know Frank just mentioned he would like to be able to have people sign up so that they receive an email WITH the comic as it is posted...
    So that is my next project...

    --
    That was a hell of a thing...
    -------------------------------------
    Galaxy Quest

Goto page: 1 - 2 [+1]

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula