Loading...
 

accesskey

The following access keys are used in TikiWIki:

  • numeric 0-9 to navigate to the nth crumb in the breadcrumb trail
  • '0' takes you home



Accesskey smarty output filter

The following output filter automatically causes the appropriate character of each link to be emphasised. This is useful as most browsers (as of mid-2005) do not automatically vistually indicate the access key.

Alternative methods of achieving the same effect include using some client-side javascript, or some crude use of CSS3 styles.

outputfilter.accesskey.php
<?php
function smarty_outputfilter_accesskey($string)
{
  return preg_replace_callback('/(<a\s+.*?accesskey="(.)"[^>]*?>)(.*?)<\/a>/i',"smarty_outputfilter_accesskey_helper",$string);
}

/**
 *  helper function - preg callback
 *
 *  $matches[1] - '<a' tag
 *  $matches[2] - accesskey
 *  $matches[3] - label to search/replace
 */
function smarty_outputfilter_accesskey_helper($matches) {
    $matches[3] = preg_replace('/(.*?)'.$matches[2].'(.*?)/', '$1<span class="accesskey">'.$matches[2].'</span>$2', $matches[3]);
  return $matches[1].$matches[3].'</a>';
}
?>


...Then just add an "a > span.accesskey" rule to your css. Alternatively, the above code could be incorporated into the outputfilter.urlt.php file, if you use this mod.
For details of how to install output filters, please follow the links from SEFURLs.

TikiTeam


Page last modified on Thursday 23 June 2005 17:33:40 GMT-0000