Here’s a dandy function I banged out today for Drupal to reorder a tree taxonomy in alphabetical order.
function reordertaxonomy($tid) {
$sql = 'SELECT term_data.tid, name, weight FROM term_data JOIN term_hierarchy ON term_hierarchy.tid = term_data.tid WHERE term_hierarchy.parent = ' . $tid;
$result = db_query($sql);
if ($result) {
$neworder = array();
while ($row = db_fetch_object($result)) {
$neworder[$row->name] = $row->tid;
reordertaxonomy($row->tid);
}
ksort($neworder);
print_r($neworder);
$i = 0;
foreach ($neworder as $termid) {
$updatesql = 'UPDATE term_data SET weight = "' . $i . '" WHERE tid = "' . $termid . '"';
db_query($updatesql);
$i++;
}
}
}
Latest Updates: drupal RSS
-
Dan
-
Dan
In Drupal when working with bread crumbs the Custom Breadcrumbs module blows Hansel out of the water. Less complicated and much more intuitive.
-
Dan
Just rolled out HTML5 Video for a client! Great success so far. The only thing I don’t like is it buffers longer than an FLV. Not as good a user experience, but I guess that’s what building for the future web is about
-
Dan
Conquered Flash5 Video with Views in Drupal. Now to get Flowplayer to loop with an object element. Sometimes the simplest things are so complicated.