Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » Uncategorized

Drupal: How To Show List Of Terms In Alphabetical Order

Submitted by on March 13, 2012 – 4:47 amNo Comment

In this article, I would tell you how Drupal allows to show a list of a certain vocabulary taxonomy terms in alphabetical order. We will also get know of how to show node list for every term.

Use the following code show the list:

<?php
$vid = 3;  // vocabulary number
$pole = array();
$items = array();
$terms = taxonomy_get_tree($vid);
usort($terms,create_function(‘$a,$b’,’return strcasecmp ($a->name,$b->name);’));
foreach ( $terms as $term ) {
$count = db_result(db_query(“SELECT COUNT(nid) FROM {term_node} WHERE tid = %d”, $term->tid));
$pole[]=Array (l($term->name, “taxonomy/term/$term->tid”) . ” ($count)”, $term->depth, $count, $term->tid)  ;
}
$depth =-1;
foreach ($pole as $list) {
if ($list[1] > $depth) echo “\n<ul>”;
if ($list[1] < $depth) echo “\n</li>\n</ul>\n</li>”;
if ($list[1] == $depth) echo “</li>”;
$poc++;
echo “\n<li>$list[0]”;
if ($list[2]>0) {
echo “\n<ul>”;
$result = db_query(“SELECT n.title, n.nid FROM {term_node} t INNER JOIN {node} n ON t.nid=n.nid WHERE t.tid=$list[3] ORDER BY n.title ASC”);
while($zaznam = db_fetch_array($result)) {
$node_link = l($zaznam[title], “node/$zaznam[nid]”);
echo “\n<li>$node_link</li>”;
}
echo “\n</ul>”;
}
$depth=$list[1];
}
echo “</li>\n</ul>”;
?>

Good luck!

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.