By soupp on
Hello
I have a problem with named anchor to navigate on one page: when I state an anchor <a name="myanchor"> and then call it with <a href="#myanchor"> drupal goes to url like this: mysite.com/myanchor instead of mysite.com/node#myanchor (?). So it just redirects me to another url instead of ancor on the same page.
How can I use anchors? How to avoid this prodlem? Maybe clean urls is a problem?
Comments
same problem
What's the solution ? get to know the id of your node so you can link to your anchor by using
. Again (see my other posts) , it's not very professional, i got people with absolutely no html knowledge that need to write structured pages for the site.
This is an important feature that needs filters like textile and htmlarea to be customized for that in drupal !!
Clean URLs
This is a limitation of the clean URLs system and the <base> tag. Just use the absolute URL, or the URL relative to your drupal root.
anchorfilter module
I wrote a little module to fix this problem. It's a filter module that will automatically change href="#myanchor" to href="path/to/node/#myanchor". I really don't know how to get it added to the modules repository here. Dries, maybe you can help me out ??
Anyhow, enjoy! and PAY IT FORWARD!
http://www.etopian.net/drupal/
regex tweak
here's a tweak to make the regex a bit more robust:
i modifier
There is an i modifier to make pregs case insensitive.
404 Not Found
Your webpage ceases to exist.
Where could I get the last version of your module?
request_uri()
or you can use
request_uri() returns the uri of the page that the user is looking at that moment.
a quick javscript solution
Refer to my post in response to another: http://drupal.org/node/13080#comment-76974
Version 4.7.x will fix
Update for any others trying to fix this:
Fixing page anchors problems for prior 4.7 versions are a much larger problem than expected. Please see the thread http://drupal.org/node/13148 (last 20-30 comments) for a fuller explanation. Version 4.7 will exhibit the expected behavior.