We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22221
    • 283 Posts
    Hello,

    I’ve modded the PrevNext snippet to add a drop down list to jump directly to another document of the current folder.

    This is the version (v0.3) of the snippet with using of placeholders and many configurable options :
    * **************************
     * Snippet: PrevJumpNext
     * By: Jeroen Bosch modded by OncleBen31
     * Date: May 2006
     * version: 0.3 (based on the PrevNext v0.9)
     * **************************
     *
     * Function:
     * Generates buttons to navigate between document of a same directory. 
     * Very handy on top or bottom of each individual newspost/log item
     * Highly configurable. It can display :
     *  - 'Prev' and 'Next' button with or without document titles
     *  - 'first' and 'last' document.
     *  - 'Index' link to parent folder
     *  - a DropList to jump quickly to a document
     *
     * You can use a classic use of the snippet or use the paginate option
     * which allow you to use PlaceHolders to personnalise your navigation 
     * buttons :
     *  - [+PJN_first+] : the first document
     *  - [+PJN_prev+] : the previous document
     *  - [+PJN_jump+] : the droplist to jump to the selectionned document
     *  - [+PJN_index+] : the link to retern to the index page
     *  - [+PJN_next+] : the next document
     *  - [+PJN_last+] : the last document
     * 
     * There is many option which can allow you to sort the document, set 
     * the text to use with the element, etc ... :
     * - sortBy : Sort items by? 'menuindex' or 'id' or 'createdon', etc... (default createdon)
     * - sortHow : Sort items How? 'ASC' or 'DESC' (default ASC)
     * - displayTitle : how 'prev' and 'next' or display document titles (default true)
     * - displayFixed : Show 'first' and 'last' (default false)
     * - usePlaceHolder : Set at true to use PlaceHolder : [+PJN_first+] , [+PJN_prev+] , [+PJN_jump+] , [+PJN_index+] , [+PJN_next+] , [+PJN_index+]  (default false)
     * - useJump : Replace the Index link by the Jump dropList when NOT using the PlaceHolders (default false)
     * - indexDocumentID :Specifie the document to go using the link "index". (by default its is the parent ID)
     * - displayNoPrevNext : set to true to display a text when there is no Prev or no Next element (default false)
     * - noPrevNextText : Text to display if there is no Prev or no Next element :(default "-")
     * - indexText : Text to use with the link "index" (default "Index")
     * - jumpText : Text to use with the dropdown list (jump function) (default :"Please Select")
     * - firstText : Text to use with the link "First" (default "<< First")
     * - prevText : Text to use with the link "Prev" when $displayTitle is set to false (default "< Prev")
     * - nextText : Text to use with the link "Next" when $displayTitle is set to false (default "Next >")
     * - lastText : Text to use with the link "Last" (default "Last >>")
     *
     *
     * The output use <div> and <span> to allow you to CSS the buttons
     * 
     *
     * Enjoy and don't esitate to ask new features
     * Exemples :
     * 
     * [[PrevNext? sortBy=menuindex &sortHow=ASC &displayTitle=true]]
     * Or
     * [[PrevJumpNext_New? &sortBy=`pub_date` &usePlaceHolder=true &indexDocumentID=`84` &firstText=`Première` &lastText=`Dernière` &prevText=`Précédente` &nextText=`Suivante` &indexText=`Liste des News` &jumpText=`Accès rapide` &displayNoPrevNext=true &noPrevNextText=`C'est le bout`]]
     * with this place holder in the document [+PJN_first+] [+PJN_prev+] [+PJN_jump+] [+PJN_index+] [+PJN_next+] [+PJN_last+] 
     */


    History :
    - v0.3 : use place holders and many option to configure it
    - v0.1: First version of the snippet : add a dropdown list to jump quickly to a page


      • 22221
      • 283 Posts
      Here it is a new version of the snippet (v0.3), with possibility to use place holder and higly configurable.

      Feel free to ask new features.

      Enjoy smiley
        • 33175
        • 711 Posts
        Thanks OncleBen smiley
          Sorry for my english. I&#39;m french... My dictionary is near me, but it&#39;s only a dictionary !
          • 27
          • 117 Posts
          Im totally crap at code, but im gonna try and change the ’Index’ text to show the Parents Pagetitle instead - if any whizkids know how its done real quick, i’d appreciate the help!

          cheers

          0
            • 7923
            • 4,213 Posts
            Quote from: 0ad at Jun 09, 2006, 05:19 AM

            Im totally crap at code, but im gonna try and change the ’Index’ text to show the Parents Pagetitle instead - if any whizkids know how its done real quick, i’d appreciate the help!

            cheers

            0
            Replace

            // Index item
            $PJN_indexPlaceHolder = "<a href='[~".$indexDocumentID."~]'>".$indexText."</a>";


            with

            // Index item
            $indexDoc = $modx->getPageInfo($indexDocumentID,0, "id, pagetitle, longtitle, description, alias, createdby");
            $PJN_indexPlaceHolder = "<a href='[~".$indexDocumentID."~]'>".$indexDoc['pagetitle']."</a>";



              "He can have a lollipop any time he wants to. That's what it means to be a programmer."
              • 27
              • 117 Posts
              That works sweet

              cheers Doze (and Jeroen Bosch and OncleBen31!)

              0
                • 21893
                • 113 Posts
                Hi Oncle Ben,
                I would like to use your snippet for a galerie, but Im not able to make it work the way I want.

                Instead of the pagetitle I would prefer a more general expression like back and forward, or prev and next. But using the following expression in a chunk, Im not able to make it.

                [[PrevJumpNext? &sortBy=`menuindex` &usePlaceHolder=true &indexDocumentID=`3` &prevText=`back` &nextText=`forward` &indexText=`Galerie` &displayTitle=false ]]
                
                
                [+PJN_prev+] [+PJN_index+] [+PJN_next+]


                Since I saw you just published a newer Version, I hope you might look around here.

                Thanks

                Nudibranch
                  Smile, it confuses people!
                  • 32519
                  • 94 Posts
                  It seems like a cool enough snippet, but I cannot get it to respond to anything. It displays the Titles no matter how I phrase it &displayTitle=false &displayTitle=`false` displaytitle=FALSE etc.

                  I’ve yet to see a prev or next button. I can’t get rid of the jump drop down list either. What am I doing wrong?

                  Here’s my callout now:
                  [[PrevNext? &startId=`8` &sortBy=`id` &sortHow=`ASC` &displayTitle=`false` &prevText=`back` &nextText=`forward` &useJump=`false`]]

                  Can anyone see something fundamentally wrong here? What the F****
                    <a href="http://www.themovietimeline.net">The Movie Timeline</a> | <a href="http://www.antstuff.net">The Antfarm Site</a>
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Try `0` instead of false. Most snippets use 0 and 1 for their boolean settings.
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 20413
                      • 2,877 Posts
                        @hawproductions | http://mrhaw.com/

                        Infograph: MODX Advanced Install in 7 steps:
                        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower