Not logged in. · Lost password · Register
Forum: General Help and Support Plugins RSS
Syntax Plugin + DokuWiki Template
Any steps necessary to make a syntax plugin work with a non-default template?
Avatar
gburch #1
Member for 2 weeks · 7 posts
Group memberships: Members
Show profile · Link to this post
Subject: Syntax Plugin + DokuWiki Template
Hi everyone,

I have a very basic syntax plugin that is tested and working with the default DokuWiki template. However when I switch to using a new template that I downloaded from the library of user-created templates, the plugin no longer functions.

Is that an expected behavior? Do I need to modify my syntax plugin at all to be compatible with the new template?

I'm new to DokuWiki development, so forgive the basic question. I'm just not sure where the template processing falls into the interpreting/rendering pipeline relative to my syntax plugin.

Thanks!
Gillen
Avatar
turnermm (Moderator) #2
Member since Oct 2009 · 4349 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
Depends on the template and what the plugin is doing.

Edit
In particular, the  bootstrap3 template injects itself into a lot of plugins and so something it is doing could affect yours.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
This post was edited on 2018-10-10, 18:35 by turnermm.
Avatar
gburch #3
Member for 2 weeks · 7 posts
Group memberships: Members
Show profile · Link to this post
Ah okay, so this is very case specific. I was wondering if from a high level there was a step that I missed - i.e. all syntax plugins need to reference all templates in some way.

How would you recommend troubleshooting this?

Some more info:
1. I'm using the template called dokui (https://sourceforge.net/projects/dokui/files/)
2. My plugin is very basic and is a modified version of the "nodisp Plugin" by Myron Turner. Essentially just recognizing text between custom tags and creating a <div> element with display=none.

The issue:
Once switching on the dokui template my custom tags show up as plain text and are no longer being interpreted as entry and exit patterns.

Thanks!!
Avatar
turnermm (Moderator) #4
Member since Oct 2009 · 4349 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
The nodisp plugin works with the dokui template.  I tested since the nodisp template is mine.  I'd have to see  the code  of your plugin to know what is going on.

The dokui template is very nice looking but a bit inconvenient, it doesn't have the standard buttons and links that help the user get around.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
gburch #5
Member for 2 weeks · 7 posts
Group memberships: Members
Show profile · Link to this post
Thanks for checking that. Yes, I can confirm it's working on my end as well in the main article.

This issue I'm having is in the navigation bars for the DokUI theme (on the top and on the sides). My entry/exit patterns load as plain text there.

Thanks :)
Avatar
turnermm (Moderator) #6
Member since Oct 2009 · 4349 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
That's because these areas do not represent a dokuwiki page and are therefore not parsed.  If you want to get dokuwiki parsed text, then you have to include you syntax markup in a dokuwiki page and then get the parsed result using this function:  p_wiki_xhtml($id). Then output the result wherever in your template you want it.   
  <?php $result=p_wiki_xhtml($id); echo $result; ?>
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
gburch #7
Member for 2 weeks · 7 posts
Group memberships: Members
Show profile · Link to this post
Thanks Myron I thought it might be something along those lines. It seems like those navbars are wiki pages, but are loaded with the "tpl_include_page" function. See the code below.

Is there a good resource that you can recommend that documents these dokuwiki functions? Just wanting to learn more about how to use p_wiki_xhtml. For example, I'm assuming $id in that function refers to some type of page ID, but I'm not sure where to find that.

Here's the code in the template currently:
$html = strip_tags(tpl_include_page('menu',0,0),'<li><a>');
echo $html;

Would something like this work:
$html = p_wiki_xhtml('menu');
echo $html;

Thanks for all your help on this. I'm a total newb to dokuwiki.
Avatar
turnermm (Moderator) #8
Member since Oct 2009 · 4349 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
Would something like this work:
$html = p_wiki_xhtml('menu');
echo $html;

Yes, if menu is a page in your top level directory.  Remember, this will output the html.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
Michaelsy #9
Member since Jun 2015 · 460 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
In reply to post #7
Quote by gburch:
Is there a good resource that you can recommend that documents these dokuwiki functions?

For example, the XRef-documentation of the tpl_include_page() function:
Cross References: https://xref.dokuwiki.org/reference/dokuwiki/nav…?_funct…
The function itself: https://xref.dokuwiki.org/reference/dokuwiki/nav…?inc/te…

Another way to explore DokuWiki is the code search: https://codesearch.dokuwiki.org/
(The code search includes plugins and templates.)

HTH - Michael Sy.
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
This post was edited on 2018-10-18, 00:45 by Michaelsy.
Avatar
turnermm (Moderator) #10
Member since Oct 2009 · 4349 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
truthfully, the xref is not the best place to start.  It's useful if you are seeking to clarify something or to examine the contexts for functions you have some familiarity with or which you encounter and would like to know more about.  For myself, if I want to check out a function, I go directly to the inc directory and grep (Linux) the function, then open the relevant files to see how it is defined and used. The functions are all commented and its these comments that provide the xref commentary.

But first of all you should learn about the general workings of Dokuwiki code.  For that I would go to dokuwiki.org and search in the devel namespace for terms like: plugin, event, environment, javascript. You get the devel namespace by prepending an @ to devel and then specifying you search term:  for instance:  @devel event.

I wasn't aware of codesearch.  It looks like it could be very useful (but again, if you already know what you are looking for.)
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
This post was edited on 2018-10-18, 01:21 by turnermm.
Avatar
gburch #11
Member for 2 weeks · 7 posts
Group memberships: Members
Show profile · Link to this post
These are great suggestions. Thanks guys.

I guess there's just no way around digging through code and piecing it together ;)

I may just keep asking dumb questions until I can get stuck in.
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: 2018-10-21, 21:09:15 (UTC +02:00)