We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4749
    • 623 Posts
    I’ve been searching for the past hour trying to find the @EVAL statement used to dynamically populate a tv. I would like to have a multi-select tv populate with the [*menutitle*] and create a list of documents to choose from. Something like this:
    @EVAL return $modx->runSnippet('Ditto' array("[*docid*] => "children"));


    Can this be done?
      The MODx has you...
      Utah Web Design
      • 4310
      • 2,310 Posts
      You could setup a TV :
      Input Type: DropDown List Menu
      Input Option Values: @SELECT pagetitle FROM modx_site_content sc LIMIT 50
      Widget:  Delimited List
      Delimiter: <br/>  

      This would then give a nice list of all docs to select from.
        • 4749
        • 623 Posts
        I need it to build a list of the documents from a specific container to create a multi-select list. I’m using the document names to create list of tags that can be assigned to a specific document. So, if that’ll work with the multi-select widget I’ll give it a try.
          The MODx has you...
          Utah Web Design
          • 4310
          • 2,310 Posts
          Try:
          @SELECT pagetitle FROM modx_site_content  WHERE parent=44

          substitute your own parent doc id
            • 29774
            • 386 Posts
            Or use my Related snippet. It uses Ditto too but does a few things Ditto chokes on inside an eval(), like create a list of documents based on a tag:
            http://modxcms.com/Related-2081.html
              Snippets: GoogleMap | FileDetails | Related Plugin: SSL
              • 4310
              • 2,310 Posts
              Yes I saw your Related snippet after I’d posted.
              Looks like a powerful tool.
              Hey, that sounds like one of the spam Viagra emails I keep getting!
                • 29774
                • 386 Posts
                grin
                  Snippets: GoogleMap | FileDetails | Related Plugin: SSL
                  • 4749
                  • 623 Posts
                  Thank you therebechips that actually sounds like exactly what I need. You just released that today? Wow, that’s great! Too bad it wasn’t a week ago, now I’ll have to go back and modify 200+ documents that already have tags, but hey, it’s worth it since I don’t have to keep adding new tags whenever I need one.

                  @bunk58 & therebechips:
                  I had my first experience with chipbuddies (sp?). A girl from South Shields made them for me. They were delicious! Lots of malt vinegar on those chips - extra tasty!

                  [EDIT]:
                  I implemented the snippet with this:
                  @EVAL return $modx->runSnippet('Related', array("parents"=>"275","inherit"=>"1","noneOption"=>"1");
                  and I’m getting this error looking at the tv in the manager:
                  Parse error: syntax error, unexpected ';' in /public_html/manager/includes/tmplvars.commands.inc.php(60) : eval()'d code on line 1
                    The MODx has you...
                    Utah Web Design
                    • 4310
                    • 2,310 Posts
                    I think you mean chip butties, as in a chip sandwich.
                    Yum Yum rolleyes
                      • 16545
                      • 358 Posts
                      Try this one - last ")" has been missed missed...
                      @EVAL return $modx->runSnippet('Related', array("parents"=>"275","inherit"=>"1","noneOption"=>"1"));