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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.