Hi. I have created a new node call "zbnews" that derive from story node. I can insert, see, and update my node. Now I want to create a way to redirect the user to an external page if he clicks onto my link zbnews/goto/{node->nid} I have this code: function zbnews_menu($may_cache) { $items = array(); if ($may_cache) { $items[] = array('path' => 'node/add/zbnews', 'title' => t('Aggiungi una notizia'), 'access' => user_access('create zbnews')); $items[] = array( 'path' => 'zbnews/goto', 'title' => t('Page redirect'), 'callback' => 'zbnews_goto', 'type' => MENU_CALLBACK, 'callback arguments' => arg(2), 'access' => user_access('access zbnews')); } return $items; } function zbnews_goto($lid = NULL, $url = NULL) { header("Location: http://www.mysite.com"); } But when I click,eg, <a href="?q=zbnews/goto/5">Link nr.5</a>, Drupal return me page not found. Where is my error ? Tnx. -- Michel 'ZioBudda' Morelli michel@ziobudda.net http://www.ziobudda.net ICQ: 58351764 http://www.phpbook.it FAX: 0291390660 TEL: 3939890025
On Tuesday 21 February 2006 06:35 am, michel ziobudda morelli wrote:
Hi. I have created a new node call "zbnews" that derive from story node. I can insert, see, and update my node. Now I want to create a way to redirect the user to an external page if he clicks onto my link zbnews/goto/{node->nid}
I have this code:
function zbnews_menu($may_cache) { $items = array();
if ($may_cache) { $items[] = array('path' => 'node/add/zbnews', 'title' => t('Aggiungi una notizia'), 'access' => user_access('create zbnews')); $items[] = array( 'path' => 'zbnews/goto',
See if 'path' => 'zbnews', works.
'title' => t('Page redirect'), 'callback' => 'zbnews_goto', 'type' => MENU_CALLBACK, 'callback arguments' => arg(2), 'access' => user_access('access zbnews')); }
return $items; }
function zbnews_goto($lid = NULL, $url = NULL) { header("Location: http://www.mysite.com"); }
But when I click,eg, <a href="?q=zbnews/goto/5">Link nr.5</a>, Drupal return me page not found.
Where is my error ?
Tnx.
-- Jason Flatt http://www.oadae.net/ Father of Six: http://www.flattfamily.com/ (Joseph, 13; Cramer, 11; Travis, 9; Angela; Harry, 5; and William, 12:04 am, 12-29-2005) Linux User: http://www.sourcemage.org/ Drupal Fanatic: http://drupal.org/
Jason Flatt ha scritto:
See if 'path' => 'zbnews', works.
OPs. No. It does not work. And now ? Tnx. -- Michel 'ZioBudda' Morelli michel@ziobudda.net http://www.ziobudda.net ICQ: 58351764 http://www.phpbook.it FAX: 0291390660 TEL: 3939890025
On Tuesday 21 February 2006 07:45 am, michel ziobudda morelli wrote:
Jason Flatt ha scritto:
See if 'path' => 'zbnews', works.
OPs. No. It does not work. And now ?
Sorry, I don't have any other ideas. In my own attempt to create a custom node type, all the URLs came up as node/$nid -- Jason Flatt http://www.oadae.net/ Father of Six: http://www.flattfamily.com/ (Joseph, 13; Cramer, 11; Travis, 9; Angela; Harry, 5; and William, 12:04 am, 12-29-2005) Linux User: http://www.sourcemage.org/ Drupal Fanatic: http://drupal.org/
Jason Flatt ha scritto:
On Tuesday 21 February 2006 07:45 am, michel ziobudda morelli wrote:
Jason Flatt ha scritto:
See if 'path' => 'zbnews', works. OPs. No. It does not work. And now ?
Sorry, I don't have any other ideas.
Resolved: function zbnews_menu($may_cache) { $items = array(); if ($may_cache) { $items[] = array('path' => 'node/add/zbnews', 'title' => t('Aggiungi una notizia'), 'access' => user_access('create zbnews')); } $items[] = array( 'path' => 'zbnews/goto', 'title' => t('Page redirect'), 'callback' => 'zbnews_goto', 'type' => MENU_CALLBACK, 'callback arguments' => $node , 'access' => user_access('create zbnews')); return $items; } But now, I have another problem: into my zbnews_goto function I want to set a new item of $node array so that in page.tpl.php I can manage it. Tnx. -- Michel 'ZioBudda' Morelli michel@ziobudda.net http://www.ziobudda.net ICQ: 58351764 http://www.phpbook.it FAX: 0291390660 TEL: 3939890025
participants (2)
-
Jason Flatt -
michel ziobudda morelli