To tell de truth: I didn't know about menu_get_object(). I have some views where blocks must be shown also; I suppose I could use arg() there to check the root of the path.
And about "Context"; I suppose you mean the module. I hadn't heard of it, but all versions are beta or alpha.... On Wed, Jan 27, 2010 at 4:13 PM, Cameron Eagans <[email protected]> wrote: > Why don't you just use Context? > ----- > Cameron Eagans > Owner, Black Storms Studios, LLC > http://www.blackstormsstudios.com > > > On Wed, Jan 27, 2010 at 4:09 AM, Lluís <[email protected]> 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. > > -- *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.
