Hello,

I have a template which has a editable field as follows;
Code: Select all
  <cms:editable
            name="type"
            label="News Type"
            opt_values='Please select=- | World=world | Technology=tech '
            type='dropdown'
            required="1"
            order="1"
        />


I am trying to create a custom list page as discussed in this page.
I edited the columns of the page however there is one thing I still could not solve. I want to replace the Filter which was prepared for the Folders and populate the dropdown with the opt_values in the editable field (named type).

I think the code below will let me do it but could not figure out how to inject my own SQL here:) Any idea how to do this?
Code: Select all
<cms:php>
    // Set info about selected folder
    global $DB, $CTX, $FUNCS;

    $fid = ( isset($_GET['fid']) && $FUNCS->is_non_zero_natural($_GET['fid']) ) ? (int)$_GET['fid'] : null;
    if( $fid ){
    $rs = $DB->select( K_TBL_FOLDERS, array('name'), "id='" . $DB->sanitize( $fid ). "'" );
    if( count($rs) ){
    $fname = $rs[0]['name'];
    }
    }

    $CTX->set( 'my_selected_fid', $fid, 'global' );
    $CTX->set( 'my_selected_fname', $fname, 'global' );
</cms:php>