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

Comments

marcvangend’s picture

Drupal has a very handy function for this problem: l(). See also http://api.drupal.org/api/function/l/6 for documentation.

Simple example:

<?php
echo l('read node 10','node/10');
?>
gpk’s picture

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

quotientix’s picture

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?

gpk’s picture

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