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]. Link to comment https://forums.phpfreaks.com/topic/216783-cant-understand-a-function/ 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... Link to comment https://forums.phpfreaks.com/topic/216783-cant-understand-a-function/#findComment-1126215 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 Link to comment https://forums.phpfreaks.com/topic/216783-cant-understand-a-function/#findComment-1126277 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.