Forums

[Plugin: Stray Random Quotes] [all-quotes] paging links problem (5 posts)

  1. Frettsy
    Member
    Posted 9 months ago #

    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?!

  2. corpodibacco
    Member
    Posted 9 months ago #

    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.

  3. Frettsy
    Member
    Posted 9 months ago #

    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/

  4. Frettsy
    Member
    Posted 9 months ago #

    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.

  5. corpodibacco
    Member
    Posted 9 months ago #

    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 :)

Reply

You must log in to post.

About this Topic