content taxonomy mező

prigo képe

bocsánat elsőre kicsit bonyolult a megfogalmazásom:

egy node-típushoz max. öt darab hierarchikus taxonómia választható. hogy megőrizze a bevitel sorrendjét öt darab beviteli mezőt hoztam létre. a feladat, az,hogy a mezők tartalmát egy mezőbe írja ki, a kategóriákat vesszővel elválasztva. ha üres a mező, a mezőnevet se írja ki.
csak a hierarchia legutolsó tagját írja ki, vannak több alkalommal is bevitt kategóriák.

pl:

korszak:

őskor - rézkor
újkor - legújabbkor
őskor
népvándorláskor

jelenlegi kód:

print('<div class="field-label">'.t('Archaeological Period Researched').":</div>");
 
 
$rev=array_reverse($node->field_kutatottkorszak);
for ($c=0;$c<count($rev);$c++) {
  //print($rev[$c][view].":&nbsp;");
  $aktterm=$rev[$c]['value'];
  $nextterm=$rev[$c+1]['value'];
  $child_terms=taxonomy_get_children($aktterm);
  unset($childs);
  $childs=array();
  foreach ($child_terms as $child) {
    $childs[]=$child->tid;
  }
  //print_r(taxonomy_get_children($aktterm));
  //print("*".$nextterm);
  //print("<hr />");
  if (!in_array($nextterm,$childs)) {
   $term=taxonomy_get_term($rev[$c]['value']);
   print($term->name." ");
  }
}
 
$rev=array_reverse($node->field_kutkor2);
for ($c=0;$c<count($rev);$c++) {
  //print($rev[$c][view]."");
  $aktterm=$rev[$c]['value'];
  $nextterm=$rev[$c+1]['value'];
  $child_terms=taxonomy_get_children($aktterm);
  unset($childs);
  $childs=array();
  foreach ($child_terms as $child) {
    $childs[]=$child->tid;
  }
  //print_r(taxonomy_get_children($aktterm));
  //print("*".$nextterm);
  //print("<hr />");
  if (!in_array($nextterm,$childs)) {
   $term=taxonomy_get_term($rev[$c]['value']);
   print($term->name." ");
  }
}
 
$rev=array_reverse($node->field_kutkor3);
for ($c=0;$c<count($rev);$c++) {
  //print($rev[$c][view].",");
  $aktterm=$rev[$c]['value'];
  $nextterm=$rev[$c+1]['value'];
  $child_terms=taxonomy_get_children($aktterm);
  unset($childs);
  $childs=array();
  foreach ($child_terms as $child) {
    $childs[]=$child->tid;
  }
  //print_r(taxonomy_get_children($aktterm));
  //print("*".$nextterm);
  //print("<hr />");
  if (!in_array($nextterm,$childs)) {
   $term=taxonomy_get_term($rev[$c]['value']);
   print($term->name." ");
  }
}
 
$rev=array_reverse($node->field_kutkor4);
for ($c=0;$c<count($rev);$c++) {
  //print($rev[$c][view]."<br />");
  $aktterm=$rev[$c]['value'];
  $nextterm=$rev[$c+1]['value'];
  $child_terms=taxonomy_get_children($aktterm);
  unset($childs);
  $childs=array();
  foreach ($child_terms as $child) {
    $childs[]=$child->tid;
  }
  //print_r(taxonomy_get_children($aktterm));
  //print("*".$nextterm);
  //print("<hr />");
  if (!in_array($nextterm,$childs)) {
   $term=taxonomy_get_term($rev[$c]['value']);
   print($term->name." ");
  }
}
 
$rev=array_reverse($node->field_kutkor5);
for ($c=0;$c<count($rev);$c++) {
  //print($rev[$c][view]."<br />");
  $aktterm=$rev[$c]['value'];
  $nextterm=$rev[$c+1]['value'];
  $child_terms=taxonomy_get_children($aktterm);
  unset($childs);
  $childs=array();
  foreach ($child_terms as $child) {
    $childs[]=$child->tid;
  }
  //print_r(taxonomy_get_children($aktterm));
  //print("*".$nextterm);
  //print("<hr />");
  if (!in_array($nextterm,$childs)) {
   $term=taxonomy_get_term($rev[$c]['value']);
   print($term->name."<br />");
  }
}

várom az ajánlatokat, előre is köszönöm:

peti

Melyik modulhoz, modulokhoz kapcsolódik a téma?: 
prigo képe

ez lemaradt: [email protected]

0
-1

Rigó Péter