From 7ce34a1c64bc9518e971df31d8e10189818e1958 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 1 Feb 2004 10:52:25 +0000 Subject: - Fixes by Goba: updated help text of mass URL aliasing and fixed escaping problem. --- modules/path/path.module | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'modules/path/path.module') diff --git a/modules/path/path.module b/modules/path/path.module index 73493a2c5..7cafefd96 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -139,15 +139,16 @@ node/view/3 => contact
 function conf_url_rewrite(\$path, \$mode = 'incoming') {
   if (\$mode == 'incoming') { // URL coming from a client
-    return preg_replace('!^display/(\d+)$!', 'node/view/\1', \$path);
+    return preg_replace('!^display/(\\d+)\$!', 'node/view/\\1', \$path);
   }
   else { // URL going out to a client
-    return preg_replace('!^node/view/(\d+)$!', 'display/\1', \$path);
+    \$aliased = preg_replace('!^node/view/(\\d+)\$!', 'display/\\1', \$path);
+    if (\$aliased != \$path) { return \$aliased; }
   }
 }
 

This function will shorten every node/view/\$node_id type of URL to display/\$node_id. Individual URL aliases defined on the browser interface of Drupal take precedence, so if you have the 'contact' page alias from the example above, then the display/3 alias will not be effective when outgoing links are created. Incoming URLs however always work with the mass URL aliased variant. Only the 'incoming' and 'outgoing' modes are supposed to be supported by your conf_url_rewrite function.

-

You cannot only use this feature to shorten the URLs, or to translate them to you own language, but also to add completely new subURLs to an already existing module's URL space, or to compose a bunch of existing stuff together to a common URL space. You can create a news section for example aliasing nodes and taxonomy overview pages falling under a 'news' vocabulary, thus having news/15 and news/sections/3 instead of node/view/15 and taxonomy/view/or/3.

"); +

You cannot only use this feature to shorten the URLs, or to translate them to you own language, but also to add completely new subURLs to an already existing module's URL space, or to compose a bunch of existing stuff together to a common URL space. You can create a news section for example aliasing nodes and taxonomy overview pages falling under a 'news' vocabulary, thus having news/15 and news/sections/3 instead of node/view/15 and taxonomy/view/or/3. You need extensive knowledge of Drupal's inner workings and regular expressions though to make such advanced aliases.

"); break; } -- cgit v1.2.3