[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: Thu, 30 Jun 2011 09:54:34 +0100

> > > > 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.
> >
> 
> Hello Chirs,
> 
> I'm not sure if I understand. For example: the following line on a
> DokuWiki page does get information from the DokuWiki environment...
> 
> "Name: <php> global $INFO; echo $INFO['userinfo']['name'];</php>"
> 
Oh?!  I'm sure I tried something like that a while ago and it didn't
work for me.

... but I just tried it again and you're quite right, everything is
there.  I wonder what I did wrong before.  It was quite a while ago when
I was still feeling my way in Dokuwiki.



-- 
Chris Green
-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: