Support » Plugins and Hacks » [Plugin: Stray Random Quotes] [all-quotes] paging links problem

  • Frettsy

    (@frettsy)


    I used the [all-quotes] function on my page here. they displayed fine but the paging links were being built incorrectly (http://calenfretts.com/index.php&qp=2 instead of http://calenfretts.com/quotes/?qp=2).

    my solution: change lines 261-262 in inc/stray_functions.php from:

    $baseurl = $_SERVER['PHP_SELF'];
    $urlpages = $baseurl.'&qp=';

    to

    $baseurl = '';
    $urlpages = $baseurl.'?qp=';

    in this way the link will be built with the current page.

    also, off topic, why is the “Select the version of WordPress you are using” on the “Add New Topic” screen not up-to-date?!

Viewing 4 replies - 1 through 4 (of 4 total)
  • corpodibacco

    (@corpodibacco)

    Frettsy, you are absolutely right, a usual sloppy coding on my part. Your fix is perfect for custom permalinks except that it would not work if someone uses a traditional permalink with a ? already in place. But I’ll think about it: and it will be fixed in the next version.

    Frettsy

    (@frettsy)

    hmm.. I see you have changed the relevant code a bit, but now, if I click the next page link, it works correctly (http://calenfretts.com/quotes/?qp=2).
    but then, if I click another page link, it is incorrect (http://calenfretts.com/quotes/?qp=2&qp=3).

    the functions on this page should help:
    http://www.addedbytes.com/php/querystring-functions/

    Frettsy

    (@frettsy)

    my fix was to add those functions into the code, then use

    $baseurl = remove_querystring_var($_SERVER['REQUEST_URI'], 'qp');
    if (strpos( $baseurl,'?'))$urlpages = $baseurl.'&qp=';

    notice I replaced ‘&’ with ‘&’ for XHTML standards.

    corpodibacco

    (@corpodibacco)

    Of course you’re right. And the functions you linked to are golden! At least for me who never studied any kind of programming language, and only navigates into PHP by sight.

    Frettsy, thanks a million for this post… I wish I had read it before I released the latest revision 1.8.3 yesterday 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Stray Random Quotes] [all-quotes] paging links problem’ is closed to new replies.