We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20912
    • 21 Posts
    Hello developers!

    I am stuck! Can not find appropriate solution! Currently I have to implement getResourses with extended filters. Therefore in order to implement this I need this feature.
    Please look at attached file. I need to create select list with all listed TV values. What would be easiest way to done it? Any great ideas acceptable!
    Output has to be something like
    <select>
    tv option 1
    tv option 2
    etc...
    </select>
      • 3749
      • 24,544 Posts
      I'm afraid I can't tell what it is you want. Can you give some more details? Is the "output" for the front-end or the Manager. Do you want the TV value for the current page or for some other page? Do you want to create a list from multiple TVs or a single TV?
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 20912
        • 21 Posts
        A want to create a list from a single TV. Which will get all possible values for this TV and create output select on the frontend. Where user can select it afterwards.Do you understand what do I want?
          • 4172
          • 5,888 Posts
          you can try this:

          create a snippet with this code:
          <?php
          //[[getoptions? &tpl=`myChunk` &tvname=`myTv`]]
          
          $tv = $modx->getObject('modTemplateVar',array('name'=>$tvname));
          $options = explode('||',$tv->get('elements'));
          
          foreach ($options as $option){
              $opt = explode ('==',$option);
              $ph['value'] = $opt[1];
              $ph['text'] = $opt[0];
              $output .= $modx->getChunk($tpl,$ph);
          }
          
          return $output;
          
          ?>
          


          and a chunk with this:

              <option value="[[+value]]">[[+text]]</option>


          and create your select with this:

          <select>
              <option disabled>Choose brand</option>
              [[getoptions? &tpl=`myChunk` &tvname=`myTv`]]
          </select>
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 20912
            • 21 Posts
            SUPER! This is exactly what I was looking for! Thank you VERY MUCH!
              • 3749
              • 24,544 Posts
              Nice code Bruno! smiley
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 4172
                • 5,888 Posts
                Quote from: BobRay at Oct 05, 2011, 06:04 PM
                Nice code Bruno! smiley

                well, it's the nice api, which let's us create nice code smiley
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!