Drupal 7: How to create dynamic link based upon url I simply want a menu item which scans the url, grabs the second argument, and plugs it into the second wildcard location of the new menu item it's creating.

So if the URL is: http://drupal.org/contenttype1/johndoe (johndoe = 2nd argument)

the menu item displayed will be: http://drupal.org/contenttype2/johndoe (johndoe = wildcard location)

So far, based upon a few forum, I've sketched out the following code, which is clearly incomplete, and it is doing nothing right now.

Basically, I just want this menu item to link to an existing page mysite.com/[coach name]/page. I'm using clean URLs by the way.

        &lt;?php
    function coachmenu_menu() {
      $items = array();

      $items['%/page'] = array(
        'title' =&gt; 'Coach Page',
        'page callback' =&gt; 'coachpagelink',
        'page arguments' =&gt; array('0'),
        'access arguments' =&gt; array('access content'),
        'type' =&gt; MENU_NORMAL_ITEM,
        'menu_name'=&gt;"menu-coach-menu",
      );
        return $items;
    }

    function coachpagelink($wildcard) {
        return $wildcard;
    }


Any ideas on what I can do?
Your code is fine except for a detail. The correct menu definition is the following one.

$items['%/page'] = array(
  'title' =&gt; 'Coach Page',
  'page callback' =&gt; 'coachpagelink',
  'page arguments' =&gt; array(0),  // Use an integer, not a string.
  'access arguments' =&gt; array('access content'),
  'type' =&gt; MENU_NORMAL_ITEM,
  'menu_name'=&gt;"menu-coach-menu",
);


If you use a string in the page arguments, the page callback is not receiving part of the URL, but that string. In your case, the page callback is always receiving '0' as argument, even when the page callback is invoked for example.com/jhondoe/page.