In CakePHP, I want to convert this URL
example.com/FAQ/What-came-first-the-chicken-or-the-egg
to
example.com/FAQ#What-came-first-the-chicken-or-the-egg
using the routes.php
and have the browser scroll to that anchor.
I tried this:
Router::connect('/FAQ/:faq',
array('controller' => 'pages', 'action' => 'faq', '#' => ':faq'),
array('faq' => '[A-Za-z-_]+')
);
If I then do debug($this->request->params)
, is says
array(
'plugin' => null,
'controller' => 'pages',
'action' => 'FAQ',
'named' => array(),
'pass' => array(),
'faq' => 'What-came-first-the-chicken-or-the-egg',
'#' => ':faq'
)
and the browser doesn't scroll anywhere.