[support] how to handle internal links

Ray Zimmerman rz10 at cornell.edu
Wed Jul 26 02:22:47 UTC 2006


On Jul 7, 2006, at 2:35 AM, Bèr Kessels wrote:
> Something in lines of [node:123] should do, imo.
>
> But otherwise a filter module (I don't  know how module develop  
> savvy you are)
> that filters all 'node/123' that inserts a link for that node/123   
> is not
> hard at all. This is the regexp:
>
>  	\bnode/[0-9]+\b
>
> And here is a great filter example module:
>  	
> http://cvs.drupal.org/viewcvs/drupal/contributions/docs/developer/ 
> examples/filter_example.module?view=markup

OK, I whipped together a filter for internal paths and internal links  
that you can download from ...

     http://www.pserc.cornell.edu/temp/ilink_filter.module

It replaces [ipath] and [ilink] tokens as follows, for a site whose  
base_url is "http://example.com/drupal":

[ipath:node/99]  -->  http://example.com/drupal/node/99
[ilink:node/99]  -->  <a href="http://example.com/base_url/node/ 
99">http://example.com/drupal/node/99</a>
[ilink:node/99:My Text]  -->  <a href="http://example.com/drupal/node/ 
99">My Text</a>

If the drupal path has an alias, the alias is used instead of the  
original path.

I'll be happy to apply for CVS access and create a project for it, if  
others would find it useful.

     Ray



More information about the support mailing list