Small code i used to create routed acnhor-links.
<code>
# Route
'page/:key' => array('index/view', 'name' => 'name_of_route',)
# Code
<?php echo Html::routed_anchor(Router::get('name_of_route'), 'Anchor text', array('key' => 'val')); ?>
# Output
<a href="http://mysite.com/page/val">Anchor text</a>
</code>
<code>
/**
* Creates an html link based on a route
*
* @param string the url
* @param string the text value
* @param array the data array
* @param array the attributes array
* @param bool true to force https, false to force http
* @return string the html link
*/
public static function routed_anchor($href, $text = null, $data = array(), $attr = array(), $secure = null)
{
$anchor = Html::anchor($href, $text, $attr, $secure);
foreach($data as $key => $val)
{
$anchor = preg_replace('#:'.$key.'#', $val, $anchor);
}
return $anchor;
}
</code>