We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I am working over my "new" site to be as MODx as possible. This includes reworking all snippets to use the Properties tab. But I’m still not sure of how it works. Let’s take as an example Jason’s most excellent ListMenuX snippet that I will be using as my main menu generator.

    Starting with line 19 we find:
    $id = !isset($id)?$modx->documentIdentifier:$id;
    $depth = !isset($depth)?0:$depth;
    $nodiv = !isset($nodiv)?false:$nodiv;
    $sDivId = empty($divId)?"":" id='$divId'";
    $sDivClass = empty($divClass)?"":" class='$divClass'";
    $sUlClass = empty($ulClass)?"":" class='$ulClass'";
    $sLiClass = empty($liClass)?"":" class='$liClass'";
    $sActiveLinkClass = empty($activeLinkClass)?"":" class='$activeLinkClass'";
    


    If I understand correctly, these lines would all be removed, and these default values would be put in the Properties form instead? Will the $modx->documentIdentifier work the same in this case?
      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
      • 32963
      • 1,732 Posts
      Yes the default properties would all be passed into the snippets.

      The $modx->docmentIdentifier is a property of the MODx DocumentParer class and cannot not be replaced my default properties
        xWisdom
        www.xwisdomhtml.com
        The fear of the Lord is the beginning of wisdom:
        MODx Co-Founder - Create and do more with less.
      • So I can’t do like so: &id=Folder ID;int;$modx->documentIdentifier

        Another dumb question: How do I do more than one? All in the same input field, separated by ... ?
          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
          • 32963
          • 1,732 Posts
          Quote from: sottwell at Jul 29, 2005, 02:57 PM

          So I can’t do like so: &id=Folder ID;int;$modx->documentIdentifier

          Another dumb question:? How do I do more than one?? All in the same input field, separated by? ... ?

          no, you can’t do this:

          &id=Folder ID;int;$modx->documentIdentifier

          but you can do this:

          &id=Folder ID;int;0

          where $id will then be passed with the value 0

          For multiple properties just separate them using a space:

          &id=Folder Id;int;0 &name=Name;string &color=Color;string;#FFCC00
            xWisdom
            www.xwisdomhtml.com
            The fear of the Lord is the beginning of wisdom:
            MODx Co-Founder - Create and do more with less.
          • Ok, got it, I think. Thanks! Will be back if I run into problems.
              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
            • Hm. There are several items here that default to "" (empty string); it doesn’t seem to like that. It saved the first one (sDivID) with nothing after the second semicolon, and dumped the rest. So you can’t use null or empty values for defaults here? (no big deal, I just gave them all a default value, but it would be nice to be clear on this issue)
                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
                • 32963
                • 1,732 Posts

                Consider this:

                &name=Name;string;

                The above will default to an empty string for $name

                Now consider this:

                &name=Name;string;mary

                The above will now default to mary for $name

                  xWisdom
                  www.xwisdomhtml.com
                  The fear of the Lord is the beginning of wisdom:
                  MODx Co-Founder - Create and do more with less.
                • The problem was that it didn’t save the entries following the first one with a null string.
                    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
                    • 32963
                    • 1,732 Posts
                    hmmmm,

                    did you save the snippet after making the changes?

                      xWisdom
                      www.xwisdomhtml.com
                      The fear of the Lord is the beginning of wisdom:
                      MODx Co-Founder - Create and do more with less.
                    • Hitting Enter automatically saves it. I did it again, using ’’ (single quotes) and this time it saved them all. Perhaps I had a typo in the earlier attempt; this time I wrote the string out in my editor and copy/pasted it. Whether there was a typo earlier, or it just didn’t like the "" (double quotes) who knows. I’ll try it again next time I modify a snippet and see.
                        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