Hi,

I am using the below stated code to display the terms associated with the page.Is there any way to show it in ascending and descending order alphabetically.

/**
* Prints an unordered list of the terms (as links) that are
* associated to the currently displayed node.

if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
    $node = node_load(arg(1));
    $vid = 2;
    $terms = taxonomy_node_get_terms_by_vocabulary($node, $vid);
    if ($terms) {
print '<ul>';
                foreach ($terms as $term) {
                print '<li>'.l($term->name, 'taxonomy/term/'.$term->tid).'</li>';

          }
print '</ul>';
    }
}

**/

Current Result:
Mango
Apple
Orange
Bananna

Required Result:
Apple
Bannana
Mango
Orange

Comments

kars-t’s picture

Status: Active » Fixed

Dear fellow Drupal enthusiasts,

this issue is now lasting for a very long time in the issue queue and was unfortunately never solved. As Drupal is a open source project everyone is helping on voluntary basis. So that this is was not solved is nothing personal and means no harm. But perhaps no one had time to deal with this issue, maybe it is too complex or did not pose the problem comprehensible.

But this issue is not the only one. There are thousands of issues on Drupal.org that have never been worked on or could not be processed. This means that we are building a wave that is unmanageable and just a problem for the Drupal project as a whole. Please help us keep the issue queue smaller and more manageable.

Please read again, "Making an issue report" and see if you can improve the issue. Test the problem with the current Core and modules. Maybe the problem doesn't exist anymore, is a duplicate or has even been solved within this issue but never closed.

Help can also be found for it on IRC and in the user groups.

In order this issue no longer remains, I put this issue to "fixed".

If there is new information, please re-open the issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.