> > > 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 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>" Kind regards, Luitzen van Gorkum ********************************************************************** Disclaimer Dit bericht kan informatie bevatten die niet voor u is bestemd. Indien u niet de geadresseerde bent of dit bericht abusievelijk aan u is toegezonden, wordt u verzocht dat aan de afzender te melden en het bericht te verwijderen. De Staat aanvaardt geen aansprakelijkheid voor schade, van welke aard ook, die verband houdt met risico's verbonden aan het elektronisch verzenden van berichten. This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. The State accepts no liability for damage of any kind resulting from the risks inherent in the electronic transmission of messages. Ministerie van Veiligheid en Justitie. ********************************************************************** -- DokuWiki mailing list - more info at http://www.dokuwiki.org/mailinglist