You are here

README.txt in Extended Path Aliases 6

Same filename and directory in other branches
  1. 7 README.txt
DESCRIPTION
===========
This module completes the job left unfinished by Drupal's Path module.
The module extends Drupal's path alias system by automatically applying
user-friendly page aliases not only to the base URL, e.g. "about-us" (for
"node/123"), but also to any of the common extensions of the base URL, e.g.
"about-us/edit", "about-us/track", "about-us/revisions*" etc.

The extended aliases may also be used when specifying visibility control for 
blocks (e.g. "about-us*"), or in fact anywhere where you are prompted to
specify pages to include or exclude.
NOTE: It is for this feature that you need to follow the INSTALLATION 
instructions below. If don't care about this feature just enable the module at 
Administer >> Site building >> Modules and you're away.

Requiring no configuration, the module then makes sure that these user-friendly
(and SEO-friendly) aliases are shown everywhere, replacing their system-
generated equivalents, whether it's in the browser address bar or on
the page itself. Examples are the Edit, Track, Revisions etc. tabs, the page
statistics pages as well as any other links on your pages. No more ugly URLs 
like node/123/revisons/456/view or user/7/track.

All of this makes everyone's user experience just that little more convenient
across all pages of your site.

INSTALLATION
============
0  If you have a compiled PECL runkit extension file (see notes at the bottom
   of this file), put it in the appropriate /extension directory.
   The runkit is not mandatory, so if you don't have a runkit.so or
   php_runkit.dll file, simply continue at step 1.

   With your runkit in place proceed with either step a) or b) (preferred).

   a) In file path_alias_xt, find the line //dl('runkit.so'). Remove the 
   leading double slashes.
   Or
   b) Edit your php.ini. You can use drupal page /admin/reports/status/php to
   locate the "Configuration File Path". It's near the top of the page and
   usually equals something like /etc/php5/apache2.
   Add this line to the other extension lines in your php.ini:

     extension = runkit.so
   
   Note: for Windows the correct line is "extension = php_runkit.dll".
   By the way, while you're down there, check that your php.ini has:

     error_reporting = E_ALL
     display_errors = On

   This ensures that if any "white screens of death" occur, these will at
   least display a clue as to what's going on.

1. As with any other module, uncompress the tar-ball, path_alias_xt.tar.gz, into
   the "sites/all/modules" subdirectory.
2. Just in case, if you are installing to a live site, put the site off-line at
   Site configuration >> Site maintenance. You will only need about 60 seconds.
3. Visit Site building >> Modules to enable the path_alias_xt module. Press
   "Save configuration".
   At this point your extended path aliases should have started to work for
   the majority of pages.
   However to get block visibility wildcards to work you need to complete
   either step 4a or 4b.

4a.If you have placed the runkit extension in the /extension directory and have
   edited your php.ini as per step 0b, you now restart your Drupal stack (or 
   just Apache). If you did step 0a, no restart should be necessary.
   In either case, verify the runkit has been loaded at /admin/reports/status or
   at /admin/reports/status/php.
   When you scroll down the page you should see a section on runkit.
4b.If you did not install the runkit extension file, you need to edit file
   "inlcudes/path.inc" using any plain text editor. In this file find the
   following line (#109 ?):

     function drupal_get_path_alias($path, $path_language = '') {

   Immediately below this line insert:

     if (module_exists('path_alias_xt')) {
       return path_alias_xt_get_path_alias($path, $path_language);
     }

5. Put your site back on line at Site configuration >> Site maintenance.

CONFIGURATION
=============
None, you're done.

USAGE
======
Users create and use aliases for nodes as per normal, i.e. via the
"URL path settings" fieldset on the Edit form. Or if you have PathAuto enabled
URL aliases for the base page are created automatically.

Let's say someone introduced "about-us" as an alias for some node, say the
system assigned node/123 to it. Whenever specifying page filters, for instance
on the page-specific visibility settings of a block's configuration page,
Site building >> Blocks >> configure, users may now type "about-us/edit",
"*about-us*" etc. rather than node/123/edit, node/123* etc.

When the system displays pages of the form "node/123/..", "about-us/.." will
be shown in the address bar instead. Plus all tabs and links on your pages are
human-readable and SEO-friendly to boot!

UNINSTALL
=========
You may disable path_alias_xt at any time, without reverting the change you've
made to path.inc, as that code auto-detects whether path_alias_xt is enabled or
not.
If you used the PECL runkit, you may want to put a semi-colon in front of the
"extension = runkit.so" line in your php.ini, so that the kit will no longer be
loaded.

CAVEATS
=======
You may run into difficulties when using this module in combination with a
module that also implements custom_url_rewrite_inbound(). There aren't many
around though, so on the vast majority of systems everything should be fine.
A generic solution would probably involve the url_alter module, which means an
extra dependency as well as more complex code. I like to keep things simple.
You should be able to use Extended Path Aliases with Domain Access, as this
module only implements custom_url_rewrite_outbound(), which is not required by
path_alias_xt.

HOW TO OBTAIN THE PECL RUNKIT EXTENSION LIBRARY
===============================================
There are some copies of runkit.so and php_runkit.dll lying about on the
internet, but most of them are old (i.e. version 0.9) and will NOT work with
PHP 5.2.x or 5.3.x. You're likely to get a white screen of death.
Check this issue for a PECL runkit library for your OS: http://drupal.org/node/760758
If there isn't one suitable for your system, you may have to compile the PECL
runkit (version 1.0) yourself, see below.

Mac/Unix/Linux
--------------
Mac users, in order for the following commands to work sign up as an Apple
Developer (free at http://developer.apple.com/programs/register), then download
and install the Xcode developer package comptabile with your OS. In addition, if
you use a MAMP stack, you may also want to point it to the Xcode header files:

$ ln -s /Developer/SDKs/MacOSX10.5.sdk/usr/include  /Applications/MAMP/bin/php5/include

If not on a Mac make sure that the following commands exist on your system:
svn, php, phpize.
If not, you can install them with a command like the following (for Ubuntu) or
similar:

$ sudo apt-get install  subversion  php5-cli  php5-dev

Now make sure you're machine is connected to the internet. Then:

$ svn co  http://svn.php.net/repository/pecl/runkit/trunk  runkit
$ cd  runkit
$ phpize
$ ./configure
$ make

For the final step, on MAMP:
$ cp modules/runkit.so /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613 (or similar number)

Whereas on most other flavours of Unix/Linux you'd go:
$ sudo make install

This *should* place runkit.so in the correct extension directory, usually
something like /usr/lib/php5/20060613. The "extension_dir" directive
should match this by default. You can verify the active "extension_dir" on the
/admin/reports/status/php page. If it doesn't match, edit your php.ini.

Windows
-------
To compile a PECL extension on Windows see for instance: 
http://blog.renangoncalves.com/2010/01/15/how-to-compile-a-pecl-extension-on-windows

File

README.txt
View source
  1. DESCRIPTION
  2. ===========
  3. This module completes the job left unfinished by Drupal's Path module.
  4. The module extends Drupal's path alias system by automatically applying
  5. user-friendly page aliases not only to the base URL, e.g. "about-us" (for
  6. "node/123"), but also to any of the common extensions of the base URL, e.g.
  7. "about-us/edit", "about-us/track", "about-us/revisions*" etc.
  8. The extended aliases may also be used when specifying visibility control for
  9. blocks (e.g. "about-us*"), or in fact anywhere where you are prompted to
  10. specify pages to include or exclude.
  11. NOTE: It is for this feature that you need to follow the INSTALLATION
  12. instructions below. If don't care about this feature just enable the module at
  13. Administer >> Site building >> Modules and you're away.
  14. Requiring no configuration, the module then makes sure that these user-friendly
  15. (and SEO-friendly) aliases are shown everywhere, replacing their system-
  16. generated equivalents, whether it's in the browser address bar or on
  17. the page itself. Examples are the Edit, Track, Revisions etc. tabs, the page
  18. statistics pages as well as any other links on your pages. No more ugly URLs
  19. like node/123/revisons/456/view or user/7/track.
  20. All of this makes everyone's user experience just that little more convenient
  21. across all pages of your site.
  22. INSTALLATION
  23. ============
  24. 0 If you have a compiled PECL runkit extension file (see notes at the bottom
  25. of this file), put it in the appropriate /extension directory.
  26. The runkit is not mandatory, so if you don't have a runkit.so or
  27. php_runkit.dll file, simply continue at step 1.
  28. With your runkit in place proceed with either step a) or b) (preferred).
  29. a) In file path_alias_xt, find the line //dl('runkit.so'). Remove the
  30. leading double slashes.
  31. Or
  32. b) Edit your php.ini. You can use drupal page /admin/reports/status/php to
  33. locate the "Configuration File Path". It's near the top of the page and
  34. usually equals something like /etc/php5/apache2.
  35. Add this line to the other extension lines in your php.ini:
  36. extension = runkit.so
  37. Note: for Windows the correct line is "extension = php_runkit.dll".
  38. By the way, while you're down there, check that your php.ini has:
  39. error_reporting = E_ALL
  40. display_errors = On
  41. This ensures that if any "white screens of death" occur, these will at
  42. least display a clue as to what's going on.
  43. 1. As with any other module, uncompress the tar-ball, path_alias_xt.tar.gz, into
  44. the "sites/all/modules" subdirectory.
  45. 2. Just in case, if you are installing to a live site, put the site off-line at
  46. Site configuration >> Site maintenance. You will only need about 60 seconds.
  47. 3. Visit Site building >> Modules to enable the path_alias_xt module. Press
  48. "Save configuration".
  49. At this point your extended path aliases should have started to work for
  50. the majority of pages.
  51. However to get block visibility wildcards to work you need to complete
  52. either step 4a or 4b.
  53. 4a.If you have placed the runkit extension in the /extension directory and have
  54. edited your php.ini as per step 0b, you now restart your Drupal stack (or
  55. just Apache). If you did step 0a, no restart should be necessary.
  56. In either case, verify the runkit has been loaded at /admin/reports/status or
  57. at /admin/reports/status/php.
  58. When you scroll down the page you should see a section on runkit.
  59. 4b.If you did not install the runkit extension file, you need to edit file
  60. "inlcudes/path.inc" using any plain text editor. In this file find the
  61. following line (#109 ?):
  62. function drupal_get_path_alias($path, $path_language = '') {
  63. Immediately below this line insert:
  64. if (module_exists('path_alias_xt')) {
  65. return path_alias_xt_get_path_alias($path, $path_language);
  66. }
  67. 5. Put your site back on line at Site configuration >> Site maintenance.
  68. CONFIGURATION
  69. =============
  70. None, you're done.
  71. USAGE
  72. ======
  73. Users create and use aliases for nodes as per normal, i.e. via the
  74. "URL path settings" fieldset on the Edit form. Or if you have PathAuto enabled
  75. URL aliases for the base page are created automatically.
  76. Let's say someone introduced "about-us" as an alias for some node, say the
  77. system assigned node/123 to it. Whenever specifying page filters, for instance
  78. on the page-specific visibility settings of a block's configuration page,
  79. Site building >> Blocks >> configure, users may now type "about-us/edit",
  80. "*about-us*" etc. rather than node/123/edit, node/123* etc.
  81. When the system displays pages of the form "node/123/..", "about-us/.." will
  82. be shown in the address bar instead. Plus all tabs and links on your pages are
  83. human-readable and SEO-friendly to boot!
  84. UNINSTALL
  85. =========
  86. You may disable path_alias_xt at any time, without reverting the change you've
  87. made to path.inc, as that code auto-detects whether path_alias_xt is enabled or
  88. not.
  89. If you used the PECL runkit, you may want to put a semi-colon in front of the
  90. "extension = runkit.so" line in your php.ini, so that the kit will no longer be
  91. loaded.
  92. CAVEATS
  93. =======
  94. You may run into difficulties when using this module in combination with a
  95. module that also implements custom_url_rewrite_inbound(). There aren't many
  96. around though, so on the vast majority of systems everything should be fine.
  97. A generic solution would probably involve the url_alter module, which means an
  98. extra dependency as well as more complex code. I like to keep things simple.
  99. You should be able to use Extended Path Aliases with Domain Access, as this
  100. module only implements custom_url_rewrite_outbound(), which is not required by
  101. path_alias_xt.
  102. HOW TO OBTAIN THE PECL RUNKIT EXTENSION LIBRARY
  103. ===============================================
  104. There are some copies of runkit.so and php_runkit.dll lying about on the
  105. internet, but most of them are old (i.e. version 0.9) and will NOT work with
  106. PHP 5.2.x or 5.3.x. You're likely to get a white screen of death.
  107. Check this issue for a PECL runkit library for your OS: http://drupal.org/node/760758
  108. If there isn't one suitable for your system, you may have to compile the PECL
  109. runkit (version 1.0) yourself, see below.
  110. Mac/Unix/Linux
  111. --------------
  112. Mac users, in order for the following commands to work sign up as an Apple
  113. Developer (free at http://developer.apple.com/programs/register), then download
  114. and install the Xcode developer package comptabile with your OS. In addition, if
  115. you use a MAMP stack, you may also want to point it to the Xcode header files:
  116. $ ln -s /Developer/SDKs/MacOSX10.5.sdk/usr/include /Applications/MAMP/bin/php5/include
  117. If not on a Mac make sure that the following commands exist on your system:
  118. svn, php, phpize.
  119. If not, you can install them with a command like the following (for Ubuntu) or
  120. similar:
  121. $ sudo apt-get install subversion php5-cli php5-dev
  122. Now make sure you're machine is connected to the internet. Then:
  123. $ svn co http://svn.php.net/repository/pecl/runkit/trunk runkit
  124. $ cd runkit
  125. $ phpize
  126. $ ./configure
  127. $ make
  128. For the final step, on MAMP:
  129. $ cp modules/runkit.so /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613 (or similar number)
  130. Whereas on most other flavours of Unix/Linux you'd go:
  131. $ sudo make install
  132. This *should* place runkit.so in the correct extension directory, usually
  133. something like /usr/lib/php5/20060613. The "extension_dir" directive
  134. should match this by default. You can verify the active "extension_dir" on the
  135. /admin/reports/status/php page. If it doesn't match, edit your php.ini.
  136. Windows
  137. -------
  138. To compile a PECL extension on Windows see for instance:
  139. http://blog.renangoncalves.com/2010/01/15/how-to-compile-a-pecl-extension-on-windows