Code:
ALTER TABLE `categories` ADD `group` VARCHAR( 100 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'Sonstige'
upload.php das suchen
PHP-Code:
$s = "<select name=\"type\">\n<option value=\"0\">(auswählen)</option>\n";
$cats = genrelist();
foreach ($cats as $row)
$s .= "<option value=\"" . $row["id"] . "\">" . htmlspecialchars($row["name"]) . "</option>\n";
$s .= "</select>\n";
und damit ersetzten
PHP-Code:
$cats = '<select name="type">
<option value="0">— Auswählen —</option>';
$get_cats = mysql_query("SELECT * FROM `categories` ORDER BY `group` ASC, `name` ASC") OR sqlerr(__FILE__, __LINE__);
$last_group = '';
while ( $cat = mysql_fetch_assoc( $get_cats ) ) {
if ( $last_group != $cat['group'] ) {
$cats .= ( !empty( $last_group ) ? '</optgroup>' : '') . '<optgroup label="' . htmlspecialchars( $cat['group'] ) . '">';
}
$cats .= '<option value="' . $cat['id'] . '">' . htmlspecialchars( $cat['name'] ) . '</option>';
$last_group = $cat['group'];
}
$cats .= '</optgroup></select>';
Nun müsst ihr noch in der DB die Kategorien in entsprechende Gruppen einteilen (siehe Bild).
Eine PHP dazu gibt es nicht, wer eine haben will muss sie sich selbst basteln.
greetz an ike der hats bei BTT gepostet