[dokuwiki] Re: Is there a Dokuwiki event when you click on a link?

  • From: Christopher Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Tue, 15 Jun 2010 17:36:08 +0100

On 15 Jun 2010, at 17:22, Chris G wrote:

> I want to write a plugin that does things when you click on a Dokuwiki
> internal link.
> 
> So, is there some sort of hook to allow me to do this, i.e. I think I
> need an event that occurs when the user clicks a link.  Looking
> through the action/events documentation I can't see anything obvious,
> so am I missing something or is there no such event?  (... or is it
> even possible in the sense that does Dokuwiki know that someone has
> clicked a link?)
> 

That depends when you want to do your things.

If you want stuff to happen in the browser, you need some javascript.  You can 
create a plugin that adds javascript to every page and uses normal javascript 
event handling to intercept clicks on internal links.  Read the development 
pages on dokuwiki's javascript.

If you want stuff to happen server side, you can use any of the early dokuwiki 
events, e.g. DOKUWIKI_STARTED or ACTION_ACT_PREPROCESS.  Typically, if the 
referrer is a normal page in the wiki and the request is to show a page, then 
the user will have clicked on an internal link (or possibly a breadcrumb or 
home page link).

- Chris

Other related posts: