[dokuwiki] Re: What's the easiest way to add a button (or a link) to execute some PHP code?

  • From: Chris G <cl@xxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 29 Jun 2011 13:49:15 +0100

On Wed, Jun 29, 2011 at 08:08:04AM +0200, Gorkum, L. van (Luitzen) wrote:
> > Van: dokuwiki-bounce@xxxxxxxxxxxxx
> [mailto:dokuwiki-bounce@xxxxxxxxxxxxx] Namens Chris G
> > Verzonden: maandag 27 juni 2011 11:47
> > Aan: dokuwiki@xxxxxxxxxxxxx
> > Onderwerp: [dokuwiki] What's the easiest way to add a button (or a
> link) to execute some PHP code?
> >
> >
> > I seem to want to do this quite often and haven't yet found an easy
> way to do it.
> >
> > I want to be able to add a button (or a link, anything 'clickable'
> will
> > do) to a Dokuwiki page that will execute some PHP code (that I have
> > written) when I click on the button/link.
> >
> > I'm quite happy to write a plugin to do this but I was wondering if
> there was something obvious I'm missing and/or an existing plugin that >
> will do what I want or provides the basic skeleton for doing it.
> >
> > --
> > Chris Green
> > --
> > DokuWiki mailing list - more info at
> http://www.dokuwiki.org/mailinglist
> 
> Hi Chris,
> 
> Configure your DokuWiki for embedded PHP and create a separate page with
> your PHP code between the <php> and </php> tags. Visit this page and
> your code get's executed...
> 
There's a problem with doing this, the embedded PHP doesn't get any of
the Dokuwiki environment.  I've actually done something fairly similar
though by writing an action plugin which uses the ACTION_ACT_PREPROCESS
and TPL_ACT_UNKNOWN to create a new action called 'tagsort'.

All that's needed then is a link like [[start?do=tagsort|link]] which
does the 'tagsort' action and I can execute the code I want in the
action plugin.

I'm just surprised that no one has wanted to do anything like this with
Dokuwiki.  I'd have preferred to have a button to click to execute the code
and stay on the same page but my quick action plugin solution is OK for the
moment.
 
-- 
Chris Green
-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: