| home | forums |
resources |
search |
news | join | members: 6954 |
Hiveminds | Thu, 2008-09-04 20:07 tags: Portals, Drupal, FireOrb Developers Network, Tutorials, menu systems Cached partThis is very simple, a search-and-replace operation. Here is a list of changes:
Non-cached partLet's suppose you had
this becomes
If we would use just a percent sign aggregator/sources/%/configure it'd match everything, including non-numeric values as well, like aggregator/sources/foo/configure. However, with %aggregator_feed we ask for a feed to be loaded based on the third argument and anything that's not a valid feed will lead to a 404. About the use of wildcards, foreach() loops and MENU_ITEMsIn Drupal 5, we used to use foreach() loops to recursively declare several MENU_ITEMs or MENU_SUGGESTED_ITEMs. In Drupal 6, we only need one entry in hook_menu() with the use of a proper wildcard. Additionally, you can create as many menu items (enabled or not) as you see fit with menu_link_save(). For a detailed discussion on this topic, see this issue. Additional Run Once CodeNon menu code that was placed in hook_menu !$may_cache so that it could be run during initialisation, should now be moved to hook_init. Previously we called hook_init twice, once early in the bootstrap process, second just after the bootstrap has finished. The first instance is now called boot instead of init. If you were using a loop in your menu code then you likely need menu_link_save. A horribly complex example can be found in the menu of http://drupal.org/files/issues/akismet.d6-port.patch. It involves just about every possible path manipulation trick one could ever need for the path akismet/%akismet/%/'. $op, and then some. It passes the real page callback in $map[0] which is a bit of a hack, but is also quite useful. This article brought to you by the
Hiveminds Magazine - Staff. Contact us if you want to post an article or announcement anonymously Thoughtbox - So what did you think? |
Content Management Systems London Hotels
Silverlight Laptop Reviews
Drupal Just Dial International Calls
Adobe Flex eRuby Excel Training Courses
PHP excel courses in london
Drupal Data Recovery
|
NewsletterGet updates on Hiveminds services, articles and downloads by signing up for the newsletter. |
Editor's choiceSome of the better articles, stories and tutorials found at Hiveminds. |
Find moreFind more of Hiveminds articles, stories, tutorials and user comments by searching. |
Picked linksHand picked websites and articles from around the web that provide quality reading. |