Subpage of a URL Alias and hook_menu Im slowly getting back into Drupal after much time away and beginning to pick it up and the learning curve is building back up.

So much so I always like to throw out pre-defined conventions as too restrictive while keeping the rough framework to build something bigger for what I want to do.

In my case, it's a scheduler program. But mine is in the context for a church, but could work equally well elsewhere 

However the idea is that each type can have a sub type, a schedule gets applied to the type and the back end calendar generates the calendar entries for the schedule. This then gets displayed in a number of ways, from an eventually RSS feed to hook into an Android application, to a Calendar and everything else in between.

Each calendar item needs to be overwritable in that it's a generic item that may have additional certain applicable details rather than being a unique entity in its own right.

This list of types should be output with a link then to each type while I alter the page then to generate a list of next upcoming schedules for that item. Click on a date and get entries for that date. etc

It's all going pretty well until I realise I need to start referring to things by database Id instead of having a nice URL because frankly, database calendar entries don't as such have a nice URL.

One of the things I would have liked to have done is to have a URL alias against a node for my event type, eg, somecategory/sometype but then to be able to use the hook_menu system to get somecategory/sometype/% (where % could be sun, mon, tue, wed etc). Bearing in mind somecategory, sometype will be variable depending on user input, only % will have a list of specific possible - sun throu sat.

Trouble is, it doesn't look like you can do it, so I've just had to use an alias such as calendar/type/% 

Any thoughts on this hook_menu issue, and any thoughts overall? 2000 lines of code into this thing and Im wondering why Im doing this (oh yeah, I like doing things my way).

Simon
I had a similar (not quite so flexible) issue.

Basically a node lives at node/NID or a url-alias path. I didnt want to write a custom hook_menu to make something so flexible as somecategory/sometype/% -- but i really think you should be able to.

I used the module view_mode_page


  On the manage display page for a given content type, you can assign
  patterns for view modes so that they will become a page at the given
  path. For instance, if you want to show the teaser at a specific URL,
  you could do node/%/teaser. If you also use Display Suite or other
  modules that allow you to create new view modes, you can use these
  modes to display one or more fields from a node at a separate URL.
  
  Restrictions: currently, the node path must be contained in the URL.
  This means view mode pages must follow the form [node path/node
  alias]/[view mode url]. These pages are added via hook_menu. Multiple
  wildcard characters can be used.


I used it to set many urls for a node of the form:
'url_pattern' =&gt; 'instructors/%/'.$val

where instructors/% IS a node alias and $val is a value from a Taxonomy Term field attached to the node. Eg, I get N-subpage urls for however many terms are in this vocabulary for each node of this content type.

I then use Display Suite to create a dynamic field for a custom view mode I associated for this node and url path; I also used Display Suite to create the custom view_mode (or maybe it was the FieldUI I forget). The dyanmic field a View that takes an argument that is the wildcard in the url.

Here's a snippet of code using the view_mode_page API:

  /*
   * Implementation of hook_view_mode_page_get_patterns() from module
   * view_mode_page.
   *
   * This lets me define additional node urls (per NID) with a custom
   * view mode.
   *
   * I then use this view_mode along with Display Suite and custom Fields
   * to completely alter how the node is viewed on that page, and only
   * show a View of related downloadable course files.
   */
  function MYMODULE_view_mode_page_get_patterns($results, $content_type,  $view_mode) {
    $results2 = array();
    $defaults = array('content_type' =&gt; 'course', 'view_mode' =&gt; 'course_materials_list_view', 'show_title' =&gt; 0, 'title' =&gt; '');

    // TODO: change this to like a Taxonomy Tree lookup.
    $terms = array('activities-and-handouts', 'administrative', 'assignments', 'data-recordings-and-transcripts','lectures','quizzes-exams','readings-and-reading-handouts');
    foreach ($terms as $pos =&gt; $val) {
      $results2[$pos] = (Object) array_merge($defaults, array('url_pattern' =&gt; 'instructors/%/'.$val));
    }
    return $results = $results2;
  }


This basically works for me. Breadcrumbs aren't totally happy. It's NOT exactly what you're asking but might help as it's very related. Good luck.