runeveryday Posted October 25, 2010 Share Posted October 25, 2010 function garland_separate_terms($node_taxonomy) { if ($node_taxonomy) { //separating terms by vocabularies foreach ($node_taxonomy AS $term) { $links[$term->vid]['taxonomy_term_'. $term->tid] = array( 'title' => $term->name, 'href' => taxonomy_term_path($term), 'attributes' => array( 'rel' => 'tag', 'title' => strip_tags($term->description) ), ); } //theming terms out foreach ($links AS $key => $vid) { $terms[$key] = theme_links($vid); } } return $terms; } this is a function from someone, i couldn't know it very well,sincerely expect someone can explain it to me .thank you. first, the function put an array $node_taxonomy as the parameter. why he didn't declare this ($node_taxonomy = array() then in the foreach loop's statement, why there is no echo to output somethig.but the fact is giving a two-dimension array to $links[$term->vid]['taxonomy_term_'. $term->tid]. Quote Link to comment Share on other sites More sharing options...
mentalist Posted October 25, 2010 Share Posted October 25, 2010 It looks like it takes an array, gets some associated data, then resorts the data in the data (not actually resort the array itself). There's also two unseen functions... Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 25, 2010 Share Posted October 25, 2010 This function looks like it's part of Drupal. Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.