Hi,
i created a Node View filtered by taxonomy term (ID terms with dept) passed by arguments.
i user php default arguments and my code return a terms id array for filtering nodes.

//NEL CASO IN CUI STO VISUALIZZANDO UN NODO 
//$args=new Array();
if (arg(0) == 'node' && is_numeric(arg(1)) ) {   
//$node = node_load( (int)arg(1));  
//$terms = taxonomy_node_get_terms($node);   

$result = db_query(db_rewrite_sql('SELECT t.tid FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.vid = %d ORDER BY v.weight, t.weight, t.name', 't', 'tid'), (int)arg(1));
    
    while ($t= db_fetch_object($result)) {
      $args[]= (string)$t->tid;
    }

}
//NEL CASO IN CUI STO VISUALIZZANDO lLA TASSONOMIA 
if (arg(0) == 'taxonomy' && is_numeric(arg(2)) ) {   
$args[]=(string)arg(2); 
} 
return $args;

when i place a block i read these warnings

  • warning: Illegal offset type in isset or empty in D:\server\wamp\www\drupal\modules\taxonomy\taxonomy.module on line 1011.
  • warning: Illegal offset type in D:\server\wamp\www\drupal\modules\taxonomy\taxonomy.module on line 1012.
  • warning: Illegal offset type in D:\server\wamp\www\drupal\modules\taxonomy\taxonomy.module on line 1015.
  • warning: preg_match() expects parameter 2 to be string, array given in D:\server\wamp\www\drupal\sites\all\modules\views\includes\handlers.inc on line 802.
  • warning: preg_match() expects parameter 2 to be string, array given in D:\server\wamp\www\drupal\sites\all\modules\views\includes\handlers.inc on line 807.
  • warning: preg_match() expects parameter 2 to be string, array given in D:\server\wamp\www\drupal\includes\bootstrap.inc on line 777.
  • warning: preg_match() expects parameter 2 to be string, array given in D:\server\wamp\www\drupal\includes\bootstrap.inc on line 777.
  • warning: preg_match() expects parameter 2 to be string, array given in D:\server\wamp\www\drupal\includes\bootstrap.inc on line 777.
  • warning: preg_match() expects parameter 2 to be string, array given in D:\server\wamp\www\drupal\includes\bootstrap.inc on line 777.
  • warning: preg_match() expects parameter 2 to be string, array given in D:\server\wamp\www\drupal\includes\bootstrap.inc on line 777.
  • warning: preg_match() expects parameter 2 to be string, array given in D:\server\wamp\www\drupal\includes\bootstrap.inc on line 777.

    if i put the block on rigth sidebar warning on bootstrap.inc on line 777 doesn't exist.
    i suppose that is can be a render order problem.

    HOW TO SOLVE?

    thans in advance.

  • Comments

    faffo’s picture

    Assigned: faffo » Unassigned
    Category: support » bug

    issue settings edited

    merlinofchaos’s picture

    Status: Active » Fixed

    In Views 2, your argument default code should return a single argument, not an array.

    faffo’s picture

    Status: Fixed » Needs review

    but if i change my code

    return $args;
    

    in

    return implode(","$args);
    

    these warnings appears:

    * warning: array_merge() [function.array-merge]: Argument #1 is not an array in D:\server\wamp\www\drupal\sites\all\modules\views\modules\taxonomy\views_handler_argument_term_node_tid_depth.inc on line 104.
    * warning: array_merge() [function.array-merge]: Argument #2 is not an array in D:\server\wamp\www\drupal\sites\all\modules\views\modules\taxonomy\views_handler_argument_term_node_tid_depth.inc on line 104.
    * warning: array_merge() [function.array-merge]: Argument #1 is not an array in D:\server\wamp\www\drupal\sites\all\modules\views\modules\taxonomy\views_handler_argument_term_node_tid_depth.inc on line 104.
    * warning: array_merge() [function.array-merge]: Argument #2 is not an array in D:\server\wamp\www\drupal\sites\all\modules\views\modules\taxonomy\views_handler_argument_term_node_tid_depth.inc on line 104.

    WHY?

    dagmar’s picture

    Status: Needs review » Fixed

    Because you don't respect the syntax of implode function

    return implode(","$args);
    

    Should be:

    return implode(",", $args);
    
    faffo’s picture

    what's a horrible mistake... :S
    thanks

    Status: Fixed » Closed (fixed)
    Issue tags: -views, -arguments, -taxonomy id depth

    Automatically closed -- issue fixed for 2 weeks with no activity.