We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27733
    • 99 Posts
    I’m needing to generate a couple tvs, one with a drop down list and one with a checkbox list, that gets its values and labels from an external data source. How is this best accomplished? (Note: I’m fine on connecting to this external source ... it’s just bridging that generated data to the tv that’s got me stuck. I’ve been trying various @bindings, but am missing something conceptually.) Thanks for any help you can provide!
      ------
      Server: *nix, ModX Evo 1.0.4, Apache 2.x, PHP 5.x, Mysql 5.x.
      • 4310
      • 2,310 Posts
      In the TV’s Input Option Values something like this...
      @EVAL if(!empty($_REQUEST['id'])){$doc_id = $_REQUEST['id'];} else $doc_id = $_REQUEST['pid']; etc etc etc} 

      You can see that after the @EVAL just use PHP. I found it only worked without line-breaks, remember to return your output at the end rolleyes
        • 27733
        • 99 Posts
        Yeah, I’d been tackling it in that way, but to no avail. I think I may be having a problem with the order of parsing. My script returns the key-value pairs in the correct format ( name==id||name2==id2||name3==id3 ... ), but it’s just a long string appearing before the <select> and is not being parsed into <option> tags. Any ideas?
          ------
          Server: *nix, ModX Evo 1.0.4, Apache 2.x, PHP 5.x, Mysql 5.x.
          • 4310
          • 2,310 Posts
          Have a look at this thread for some ideas on creating the select items for the TV.
            • 27733
            • 99 Posts
            Thanks for the pointers! Well, I was trying to do this cleanly, with includes (one for the external db connector and one for the script getting the data for the tv) but it didn’t work. Stringing both of these php files into a no-newline mess of code did the trick. I hope doing this sort of thing has been eased in Revo (which I look forward to getting into in the coming months) wink
              ------
              Server: *nix, ModX Evo 1.0.4, Apache 2.x, PHP 5.x, Mysql 5.x.
              • 4310
              • 2,310 Posts
              It may look ugly, but if it works grin