Your current approach is heading towards a world of hurt. Why not just use PHP for your block visibility? <?php if ($node = menu_get_object()) { return in_array($node->type, array('my-type1', 'my-type2')); } ?> Dave Reid dave@davereid.net On Wed, Jan 27, 2010 at 5:09 AM, Lluís <enboig@gmail.com> wrote:
I have some custom nodes and I need some blocks to appear depending on node-type.
My approach to solve the problem was replicate "/node/$nid" behavior to "/my-type1/$nid" in order to make blocks visible depending on node-type. If a user entered a view to "/node/$nid" he got "drupal_goto" to the right url.
My problem now is that for some node-types /type/$nid works, but /node/$nid stopped working; any hint? I am completely lost right now.
== hook_nodeapi == ..... case 'view': if ((arg(0)=='node')&&(arg(1)==$node->nid)) { switch ($node->type) { case 'my-type1': case 'my-type2': drupal_goto($node->type.substr($_GET['q'],4)); break; .....
== hook_menu == ...... foreach($node_types AS $key) { $items[$key.'/%node'] = array( 'title callback' => 'node_page_title', 'title arguments' => array(1), 'page callback' => 'node_page_view', 'page arguments' => array(1), 'access callback' => 'node_access', 'access arguments' => array('view', 1), 'file' => 'node.module', 'file path' => drupal_get_path('module', 'node'), 'type' => MENU_CALLBACK, ); $items[$key.'/%node/view'] = array( 'title' => 'View', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); ......
-- *Les normes hi són perquè hi pensis abans de saltar-te-les *La vida és com una taronja, què esperes a exprimir-la? *Si creus que l'educació és cara, prova la ignorància. *La vida és com una moneda, la pots gastar en el que vulguis però només una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.