We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3349
    • 126 Posts
    I’ve had a look but cant find what im looking for...

    Im looking to display a dropdown list in the frontend of my site and fill it with resources of a specific parent folder from the manager...

    Is there something already about that would do this?

    Thanks
      • 4310
      • 2,310 Posts
      For Evo this old/simple snippet creates a drop down link list to the child pages of a given document.
      <?php
      $o = '';
      $o .= '<ul>';
      $result = $modx->db->query('SELECT * FROM `modx_site_content` WHERE parent = 29 AND published = 1 AND deleted = 0 ORDER BY pagetitle ASC LIMIT 0, 30 '); 
      $rs = $modx->db->makeArray( $result );
      foreach( $rs as $val ) {	
      $o .= '<li><a href="[~'.$val['id'].'~]" title="'.$val['pagetitle'].'">'.$val['pagetitle'].'</a></li>';
      }
      $o .= '</ul>';
      return $o;
      ?>