[eluser]coolfactor[/eluser]
My current solution involves intercepting the call to Router::_set_request() with the following:
Code:
function _set_request($segments = array()) {
if ($seg = array_pop($segments)) {
$i = strpos($seg, '#');
if ($i !== FALSE) {
list($seg, $this->uri->anchor) = explode('#', $seg);
}
if ($seg) {
$segments[] = $seg;
}
}
return parent::_set_request($segments);
}
Basically, it checks to see if "#" exists in the last segment, extracts the anchor name into
$this->uri->anchor, restores the last segment without the anchor, and then passes control on to the stock _set_request() function to continue processing.
The code gracefully handles routes with and without a trailing slash:
Code:
/page/info#mission
/page/info/#mission
The URI class would need to be adjusted to utilize the
$this->uri->anchor property.