Fix for in_array problem

  1. function security_list_term_voc($vid) {
  2.         $items = array();
  3.         $terms = taxonomy_get_tree($vid);
  4.         foreach ( $terms as $term ) {  
  5.         $count = db_result(db_query("SELECT COUNT(nid) FROM {term_node} WHERE tid = %d", $term->tid));  
  6.             $items[] = $term->name;
  7.         }
  8.         if($items) {
  9.             $output .= implode(" ",$items);
  10.         }
  11.          return $output;
  12. }
  13.  
  14. The function is used here:
  15. <?php $titlearray = security_list_term_voc(3); ?>
  16. <?php if($node->type == 'page' || $node->type == 'webform' || $node->type == 'resource' || in_array($title,$titlearray,true)): ?>
  17.  
  18. I get the following error:
  19.  
  20. warning: in_array() [function.in-array]: Wrong datatype for second argument in page.tpl.php on line 104.

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.