When I am coding my custom input filter module, I want to allow insertion of local anchors within the page. The user is allowed to create <a name="xxx" id="xxx"></a>. Then I would like to produce a code so that a link pointing to that anchor can be created in the page (consider a page TOC at the top).

The problem I encounter is: when I try to simply use <a href="#xxx">Link it!</a>, the link turns out to become pointing to http://www.foo.com/druap/#xxx, which is wrong.

How can I write a code so that a link to a local anchor can be created?

Thanks!

Comments

mr700’s picture

The problems is caused by the use of the <base href="yourdir" /> tag in drupal. As a workaround you can use <a href="/node/NID#inner">link</a> for now, or wait for drupal 4.7 (AFAIK it will not use this tag to workaround google's bug).

vancelee’s picture

as I am in an input filter module I don't know how can I fetch the node ID my filter is currently working on. Is there way I can know the node ID the filter is working?

Thanks.