[Pmwiki-users] Further information on accesskeys
Christian Ridderström
chr
Tue Feb 17 21:08:29 CST 2004
Hi
While configuring for pmwiki 0.6, I've done some additional work on using
accesskeys. Here's the relevant code from my config.php:
First the code that redefines the wiki commands:
$PageLayoutFmt['wikicmds']=
"\n ".FmtAccessLink('$ScriptUrl/$[$Group/RecentChanges]',
'Recent changes', 'C').
"\n ".FmtAccessLink('$PageUrl?action=print','Printable view','P').
"\n ".FmtAccessLink('$PageUrl?action=diff','Page history','I').
"\n ".FmtAccessLink('$PageUrl?action=upload','Upload file','U').
"\n ".FmtAccessLink('$PageUrl?action=edit','Edit page','E');
where FmtAccessLink() is used to produce a A-tag as follows:
// Return HTML-code for an A-tag with an accesskey
function FmtAccessLink($url, $txt, $key){
// Define mb_strto... these are needed if PhP < 4.3.0
if(!function_exists('mb_strtoupper')) {
function mb_strtoupper($s) { return strtoupper($s); } }
if(!function_exists('mb_strtolower')) {
function mb_strtolower($s) { return strtolower($s); } }
$pos = strpos($txt, mb_strtoupper($key));
if($pos === false) $pos = strpos($txt, mb_strtolower($key));
if($pos !== false)
$txt = substr($txt, 0, $pos).
"<span class='accesskey' >".$txt[$pos]."</span >".substr($txt,$pos+1);
return "<a href='$url' accesskey='".$key."' >".$txt."</a>";
}
This works fine for me, but it would be nice if it could be made to work
with the translation mechanism (which I don't know how it works). In an
ideal situation I guess that any accesskey should be defined together with
the translated message?
/Christian
--
Christian Ridderstr?m http://www.md.kth.se/~chr
More information about the pmwiki-users
mailing list