Jump to content

can't understand a function


runeveryday

Recommended Posts


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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.