Not logged in. · Lost password · Register
Forum: General Help and Support Plugins RSS
Order of evaluation for plugins
Avatar
ChrisLuk #1
Member since Jun 2017 · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: Order of evaluation for plugins
How does Doku determine the order of evaluation controlled for plugins & can it be changed?

e.g. I would like to use Variable values [[https://www.dokuwiki.org/plugin:var]] within an SQL Query [[https://www.dokuwiki.org/plugin:sqlquery]]

But  <sql>SELECT '@PAGE@' FROM DUAL;</sql> just displays @PAGE@

Is this just a specific case of the limitation that "This plugin doesn't work within titles, links and other substitution patterns, for technical reasons."
Avatar
LarsDW223 #2
Member since Sep 2014 · 422 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
Is this just a specific case of the limitation that "This plugin doesn't work within titles, links and other substitution patterns, for technical reasons."

Yes, the sqlquery plugin does not allow other syntax plugins to be called for the part between it's own tags (<sql>...<sql>). But if you are only interested in getting this single case working - use var-plugin-syntax in sqlquery-plugin-syntax - you might want to try to place a feature request at the sqlquery plugin issue tracker (see https://github.com/digitalduke/SQLquery/issues). There is no guaranty that it is going to be changed but it's worth trying.
Avatar
cziehr #3
Member since Jan 2011 · 589 posts · Location: 10119 Berlin
Group memberships: Members
Show profile · Link to this post
In reply to post #1
In action-plugins, there is always this function:

function getSort(){
        return 999;
    }

See https://www.dokuwiki.org/devel:syntax_plugin_skeleton

This number declares the order in which the syntax substitutions are executed. Lower numbers are executed first, higher ones later on.
Avatar
LarsDW223 #4
Member since Sep 2014 · 422 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
@cziehr: yes - that function is also present for syntax plugins. But IMHO that is only helpful if two syntax plugins use the same syntax pattern/tag. I think in this case the problem is that the plugin does not allow any nested other sytnax plugins to be called:

getAllowedTypes() (default value: array()) Should return an array of mode types that may be nested within the plugin's own markup.
(see page https://www.dokuwiki.org/devel:syntax_plugins)
Avatar
cziehr #5
Member since Jan 2011 · 589 posts · Location: 10119 Berlin
Group memberships: Members
Show profile · Link to this post
Quote by LarsDW223:
@cziehr: yes - that function is also present for syntax plugins.

Sorry, I meant syntax plugins. I don't know why I wrote action plugins.

I've already written two syntax plugins, but I'm far away from being an expert.
Avatar
turnermm (Moderator) #6
Member since Oct 2009 · 4675 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
In reply to post #4
At the same time that getAllowedTypes() declares what syntax types can be contained within the plugin, getType() declares the type that defines the plugin.  If a plugin is of a type that is allowed by another plugin, then it can be contained by the other plugin.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-07-23, 00:43:12 (UTC +02:00)