Building Rock Solid Websites

.

Blogs

Taxonomy Select List

In building an Image Map for a client site today, I figured I had better make a Drop Down select list box for the users who are pointer impaired (eg phone users). I decided to do it the easy way;

<?php //Build drop down select box for choosing State...not the Drupal way, but faster!
$states = db_query("SELECT name FROM {taxonomy_term_data} WHERE vid = 3")->fetchAllAssoc('name');

$states = (array) $states;

?>

<?php
foreach ($states as $key=>$val){
$statelink = $val->name;
$slink = str_replace(' ','-',$statelink);
echo ''.$statelink.'';
}
?>

All of the above gets added to the Views template.