We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10896
    • 76 Posts
    I have a tv that is a drop-down list menu. I also have it set with five different option values. I want to find a way to output these values either as an array or in a way that I can load the values into an array in a snippet that I’m working on. I want to do this dynamically because other people may add values to this tv in the future and I don’t want them to have to dig in this snippet code to make the updates work. Is there an API function that does this?

    Thanks!
    -bryan

      • 10896
      • 76 Posts
      Ok. I’m not sure if this is the most elegant solution for this problem but I found this works:

      $result = $modx->db->select("elements", "modx_site_tmplvars", "id = 28");
      while($row = $modx->db->getRow($result)) {
          $value_string = $row['elements']; 
      }
      
      $value = explode('||',$value_string);
      print_r($value);
      


      If someone knows a better solution please let me know.

      Thanks!