[pmwiki-users] Feature request: Action lists in skins
Joachim Durchholz
jo at durchholz.org
Mon Apr 4 06:43:43 CDT 2005
Hi all,
there's a feature I'd like to request, but I don't know whether that has
been discussed before.
The problem I'm having right now is that I have to edit the list of
actions on each skin before I can use it. And that's bad: whenever I
update the skin, or wish to experiment with a different skin, I have to
remember that the action list needs to be updated.
So it would be best to have the skin just specify where the action list
should go, but not specify the actions themselves. That is,
<a href='$ScriptUrl/$[$Group/RecentChanges]'>$[Recent Changes]</a>
<a href='$PageUrl?action=print' target='_blank'>$[Printable View]</a>
<a href='$PageUrl?action=diff'>$[Page History]</a>
<a href='$PageUrl?action=edit'>$[Edit Page]</a>
would become something like
<!--Actions-->
There's one ramification: several skins insert some HTML between action
links. It may be as simple as
<a href='$ScriptUrl/$[$Group/RecentChanges]'>$[Recent Changes]</a>
·
<a href='$PageUrl?action=print' target='_blank'>$[Printable View]</a>
·
<a href='$PageUrl?action=diff'>$[Page History]</a>
·
<a href='$PageUrl?action=edit'>$[Edit Page]</a>
or as elaborate as (sorry for removed indentation, it wouldn't fit on 72
characters anymore):
<table>
<tr>
<td>
<a href='$ScriptUrl/$[$Group/RecentChanges]'>$[Recent Changes]</a>
</tr>
</td>
<tr>
<td>
<a href='$PageUrl?action=print' target='_blank'>$[Printable View]</a>
</tr>
</td>
<tr>
<td>
<a href='$PageUrl?action=diff'>$[Page History]</a>
</tr>
</td>
<tr>
<td>
<a href='$PageUrl?action=edit'>$[Edit Page]</a>
</td>
</tr>
</table>
... [rummaging in the PmWiki code]...
seems there's already a <!--function:func(parameters)--> markup or
something in place. That would suit perfectly: define a function
function PrintActions($delimiter) {
return
implode(
$delimiter,
array_map(
FmtOneAction,
keys($HandleActions),
values($HandleActions)))
}
function FmtOneAction($key,$value) {
return "<a href=$ScriptUrl?action=$value>$[$key]</a>";
}
and let template writers say
<!--function:PrintActions ·-->
instead of specifying the full action list.
What do you think?
Regards,
Jo
P.S.: I'm pretty sure that the PHP code above contains dozens of tiny
errors. It was jotted down in a few minutes just to outline a strategy
that sounded viable to me; I'd still have to spend a couple of hours to
identify and correct mistaken assumptions about how PmWiki works and
what's stored where, and eliminating the PHP errors that I most likely
threw in. I'd invest that time if encouraged though; I could use some
PHP training ;-)
P.P.S.: I found that something very similar to this is already part of
the "cmslike" recipe. I think this should go into the core so that skin
writers can use it.
More information about the pmwiki-users
mailing list