[dokuwiki] Retrieving template from plugin JavaScript

  • From: Damien Regad <dregad@xxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 19 Feb 2021 01:01:04 +0100

Greetings,

I need to use the current template in a plugin's script.js, but AFAIK
this information is not readily available.

My first idea was to use DOKU_TPL and extract the template name from the
path, e.g.

let template = DOKU_TPL.replace(/[\\/]$/, "").split(/[\\/]/).pop();

Then I wondered if it would not be better to export that from
$conf['template'] into JSINFO instead, as documented here
https://www.dokuwiki.org/devel:javascript#jsinfo

Thoughts / advice on the better approach would be appreciated.

Cheers
Damien

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

Other related posts: