We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    mm ok I tweakt it a bit if you run this as a snippet in your page within the form then this should work.

    $output ="<select name=’parent’>"; is the inportent part this will tell the modded version of newspublisher I made that this is the parent to use.

    <?php
    $table = $modx->getFullTableName("site_content");
    $sql_result = $modx->db->select("id, pagetitle, parent", $table, "isfolder = 1 AND pagetitle <> 'Admin'", "menuindex DESC");
    
    $output ="<select name='parent'>";
    if(mysql_num_rows($sql_result)) { 
    $output .= "<option value='0'>Root</option>";
    while ($row = mysql_fetch_assoc($sql_result)) {
    
    $cid = $row['id'];
    $pdata = $modx->getParent($cid,1,'id');
    $pid = $pdata['id'];
    
    if($pid == "") { 
    $pid = "0"; 
    } 
    
    if ($row['id'] == $pid) {
    $selected = " selected";
    } else {
    $selected = ""; 
    }
    
    $output .= "<option value='".$row['id']."'".$selected."> ".$row['pagetitle']."</option>";
    } 
    }
    else {
    $output .= "<option value='0'>Root</option>";
    }
    return $output."</select>";
    ?>
    


    Greets Dimmy
      follow me on twitter: @dimmy01
      • 9549
      • 93 Posts
      You’re awesome Dimmy. Thanks!