problems with '#' in URLs
der100 - August 21, 2009 - 19:13
| Project: | Global Redirect |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I try:
node/52753 -> skill/3517/penmanship#skills
but when I attempt to browse to node/52753
I get redirected to skill/3517/penmanship%2523skills

#1
If you are using Drupal's l() or url() functions to construct the URL, you need to pass in fragments (plus queries and other items) as part of the options array.
Ie,
<?php
$url = url( 'skill/3517/penmanship', array( 'fragment' => 'skills' ) );
$link = l( 'Link text', 'skill/3517/penmanship', array( 'fragment' => 'skills' ) );
?>
If you're just trying to do it with just a straight URL Alias, I don't think that's possible. Why would a node need to define it's URL alias as pointing to a specific section of itself? Just do a normal alias and construct your links (with or without # fragment) at the theming layer using l() or url().
#2
The '#skills' portion is for a tabbed/accordion display.
'skills' is the tab that we want to be active when the page is displayed.
#3
Why not just make the #skills section open by default when there's no anchor specified?