path_help
- Versions
- 4.6 – 5
path_help($section)- 6 – 7
path_help($path, $arg)
Implementation of hook_help().
Code
modules/path.module, line 11
<?php
function path_help($section) {
switch ($section) {
case 'admin/modules#description':
return t('Allows users to rename URLs.');
case 'admin/path':
return t("<p>Drupal provides users complete control over URLs through aliasing. This feature is typically used to make URLs human-readable or easy to remember. For example, one could map the relative URL 'node/1' onto 'about'. Each system path can have multiple aliases.</p>");
case 'admin/path/add':
return t('<p>Enter the path you wish to create the alias for, followed by the name of the new alias.</p>');
case 'admin/help#path':
return t("
<h3>Background</h3>
<p>A very powerful feature of Drupal is the ability to have control over all paths. The path module is the tool that provides this functionality and is part of the basic Drupal installation, although it is not enabled by default. Some examples of re-mapping paths are:</p>
<pre>
user/login => login
image/tid/16 => store
taxonomy/term/7+19+20+21 => store/products/whirlygigs
node/3 => contact
</pre>
<p>This functionality integrates seamlessly into node forms and also provides the administrator an interface to view all aliases that have been created.</p>
<p>Aliases have a many to one relationship with their original Drupal URLs. In other words you can have many different aliases map to a single path. An example of where a multiple aliases come in handy is creating a standard RSS feed URL:</p>
<pre>
node/feed => rss.xml
node/feed => index.rdf
</pre>
<p>When Drupal generates links for a path with multiple aliases it will choose the first alias created per system URL. So in our above example, Drupal would use rss.xml as the default alias rather than index.rdf. To change this behavior, delete the aliases for node/feed and create the index.rdf alias before rss.xml.</p>
<h3>Permissions</h3>
<p>Two permissions are related to URL aliasing: <em>create url aliases</em> and <em>administer url aliases</em>.</p>
<ol><li><strong>create url aliases</strong> - Allows users to create aliases for nodes. Enabling this permission will display a path field to the user in any node form, allowing them to enter an alias for that node. They will be able to edit/delete the alias after it is created using the same form.</li><li><strong>administer url aliases</strong> - Allows users to access the alias administration interface. This interface displays all aliases and provides a way to create and modify them. This is also the location to build aliases for things other than nodes. For example, you can create an alias for a taxonomy URL or even re-map the admin path (although the original admin path will still be accessible since aliases do not cancel out original paths).</li></ol>
<h3>Mass URL aliasing</h3>
<p>Drupal also comes with user defined mass URL aliasing capabilities. You might like to see completely different URLs used by Drupal, or even URLs translated to the visitors' native language, in which case this feature is handy. Only an administrator with access to the website source code can set up this kind of aliases. You can define a <code>conf_url_rewrite</code> function in your configuration file (eg. sites/default/settings.php), following this example:</p>
<pre>
function conf_url_rewrite(\$path, \$mode = 'incoming') {
if (\$mode == 'incoming') { // URL coming from a client
return preg_replace('!^display/(\\d+)\$!', 'node/\\1', \$path);
}
else { // URL going out to a client
\$aliased = preg_replace('!^node/(\\d+)\$!', 'display/\\1', \$path);
if (\$aliased != \$path) { return \$aliased; }
}
}
?>Login or register to post comments 