Avoiding absolute links in Blocks?
rubaff - May 9, 2008 - 09:51
Hi there,
on my site I have a block that contains one link to a node. The block is always visible.
The question is: how do I format the href?
If I format it to "node/10", it works on the home-site, but doesn't work on subpages like node/3, since the link then would produce the URL node/node/10.
Does anyone know how to solve this problem?
Many thanks!
PS: Clean URLs are activated

Drupal has a very handy
Drupal has a very handy function for this problem: l(). See also http://api.drupal.org/api/function/l/6 for documentation.
Simple example:
<?phpecho l('read node 10','node/10');
?>
1. Maybe absolute links
1. Maybe absolute links ain't so bad? /node/10 will always work..
2. http://drupal.org/project/pathfilter lets you specify the href as "internal:node/10" and sorts out the rest (including converting to a URL alias if one exists)
gpk
----
www.alexoria.co.uk
Thx
thanks for the quick replies.
/node/10 works fine (node/10 [without slash at the beginning] doesn't - my bad).
I tried the pathfilter module anyways, But I keep getting error messages from the browser (wrong protocol). I defined the href as "internal:node/10", right?
Have a look at the
Have a look at the pathfilter documentation. IIRC think you need to add the filter (provided by the module) to one of your input formats.
gpk
----
www.alexoria.co.uk