We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19889
    • 616 Posts
    Hello,
    I like to have some PREV/NEXT navigation on my news entry pages - I thought of creating a checkbox TV that gets inherited so I would only need to set it on the folder.

    However, know I’m stuck - how would I have to proceed in order to get the PREV/NEXT navigation onto the single entry page but not the news container - how would I run the PREV/NEXT snippet based on whether the check box is checked or not.

    Hope somebody can help me a little

    thank you
      • 7231
      • 4,205 Posts
      I’m not 100% sure I understood. Here are some ways I have used to have a checkbox hide a snippet.

      1) use a checkbox, put the snippet call in a chunk and then use the TVConditional snippet to either display the chunk it the condition of the checkbox is true.

      [[tvcnd? &tv=`hideSubNav` &cnd=`yes, 1` &rtn=`subNavigation`]]


      2) Use PHx. I don’t know the syntax since I have not used serious PHx yet.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 19889
        • 616 Posts
        something like this seems to work but I don’t know whether this makes sense at all - I’m sure there is a better way to do it:

        $tv = $modx->getTemplateVarOutput(array('tvPrevNext'), $modx->documentIdentifier);
        $l  = $tv['tvPrevNext'];
        
        
        if ($l == 'yes' && $modx->documentObject['isfolder'] == 0) {
        return "[[PrevNext?&sortHow=`desc`]]";
        


        I still don’t really get however how I have to setup the tv checkbox - it looks that I need to create two values to create two checkboxes to make it work although that doesn’t make sense two me - a checkbox already as two values: checked and unchecked but that doesn’t work
          • 7231
          • 4,205 Posts
          I still don’t really get however how I have to setup the tv checkbox - it looks that I need to create two values to create two checkboxes to make it work although that doesn’t make sense two me - a checkbox already as two values: checked and unchecked but that doesn’t work
          I use just one value and have the script use either the default value if the checkbox is not active or a custom action if the checkbox is selected.

          It seems to me that a checkbox TV only has a value in the active state, when inactive they have no value rather than the ’off’ state value.
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don't know what it is.
            Do you, Mr. Jones? - [bob dylan]