summaryrefslogtreecommitdiff
path: root/modules/path/path.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-02-01 10:52:25 +0000
committerDries Buytaert <dries@buytaert.net>2004-02-01 10:52:25 +0000
commit7ce34a1c64bc9518e971df31d8e10189818e1958 (patch)
treeabb9ef52442fb157f8913c6b6c1fd12f3ddecd82 /modules/path/path.module
parentcfcba7cfbb1ed5b926771a569417cba125677e24 (diff)
downloadbrdo-7ce34a1c64bc9518e971df31d8e10189818e1958.tar.gz
brdo-7ce34a1c64bc9518e971df31d8e10189818e1958.tar.bz2
- Fixes by Goba: updated help text of mass URL aliasing and fixed escaping problem.
Diffstat (limited to 'modules/path/path.module')
-rw-r--r--modules/path/path.module7
1 files changed, 4 insertions, 3 deletions
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
<pre>
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; }
}
}
</pre>
<p>This function will shorten every <code>node/view/\$node_id</code> type of URL to <code>display/\$node_id</code>. 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 <code>display/3</code> 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 <code>conf_url_rewrite</code> function.</p>
-<p>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 <code>news</code> section for example aliasing nodes and taxonomy overview pages falling under a 'news' vocabulary, thus having <code>news/15</code> and <code>news/sections/3</code> instead of <code>node/view/15</code> and <code>taxonomy/view/or/3</code>.</p>");
+<p>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 <code>news</code> section for example aliasing nodes and taxonomy overview pages falling under a 'news' vocabulary, thus having <code>news/15</code> and <code>news/sections/3</code> instead of <code>node/view/15</code> and <code>taxonomy/view/or/3</code>. You need extensive knowledge of Drupal's inner workings and regular expressions though to make such advanced aliases.</p>");
break;
}