Pager Link Structure Bug Workaround

edited July 2011 in Feedback
Not too elegant, but:

In file class.voting.plugin.php roundabout line 390 paste one line to correct the linkstructure of the popular page's pager.

// Build a pager. $PagerFactory = new Gdn_PagerFactory(); $Sender->Pager = $PagerFactory->GetPager('Pager', $Sender); $Sender->Pager->ClientID = 'Pager'; $Sender->Pager->Configure( $Offset, $Limit, $CountDiscussions, 'discussions/popular/%1$s' ); //paste following line $Sender->SetData('_PagerUrl', 'discussions/popular/{Page}');

In your apache settings add following Rewrite:
RewriteRule ^/discussions/popular/(p)(\d*)$ /discussions/popular/$2 [R,L]
Tagged:

Answers

  • No it´s still not working:(

    My above workaround is working only for some time,
    because the Pager does not update it´s position.

    Could anyone help me, please?

    The $Sender->Pager->Configure() seems to fail.

    $Sender->Pager->Configure( $Offset, $Limit, "2", 'discussions/popular/HELO', True ); $Sender->Pager->Url = 'HELO';

    Althoug I set something strange, the URLs of the Pager are still like:

    http://domain/discussions/popular?Page=p7&

    I saw a force configure in the file class.pagermodule.php
    and tried it with the True-option in the 4th position of the Configure-Array.

    But no luck.















  • It seems a solution was never reached above. Does anyone else have the problem of the pager not changing from the first page for "Popular". Does anyone have a solution to this, I have been unsuccessful so far.

  • edited February 2012

    Finally got the paging to work correctly when sorting by popular.

    In the function DiscussionsController_Popular_Create($Sender)

    Add this:

    list($Offset, $Limit) = OffsetLimit($Offset, C('Vanilla.Discussions.PerPage', 30)); $Sender->CanonicalUrl(Url(ConcatSep('/', 'discussions', PageNumber($Offset, $Limit, TRUE)), TRUE));

    Right before:

    if (!is_numeric($Offset) || $Offset < 0) $Offset = 0;

    And remove the line:

    $Limit = C('Vanilla.Discussions.PerPage', 30);

    Now paging should work correctly!

  • I did exactly as you did and get the same popular?Page=p3& url's coming up.

  • Let me try

  • no thing changed after did the same thing

Sign In or Register to comment.