Not logged in. · Lost password · Register
Forum: General Discussion Plugins RSS
Plugin development: How to add header and how to change body tag
pascal #1
Member for 2 months · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: Plugin development: How to add header and how to change body tag
Hi all,

i've created my first syntax plugin and it works fine, but now i have two problems:

I want to add a line to the head section:
<script src="http://..." type="text/javascript"></script>

And i want to change <body> to this: <body onload="onLoad();" onresize="onResize();">

Is it possible to do this with a syntax plugin?

Thank you!!
Pascal
ChrisS #2
Member since Sep 2006 · 82 posts
Group memberships: Members
Show profile · Link to this post
Plugins can add their own javascript files.  Take a look at the folded plugin.

You don't want to add an "onload" event in body.  By doing so you are obliterating any other use of that event.  See the notes on javascript and plugins (in particular plugin file structure) at splitbrain.

http://wiki.splitbrain.org/wiki:devel:javascript
http://wiki.splitbrain.org/wiki:plugins:file_structure
pascal #3
Member for 2 months · 3 posts
Group memberships: Members
Show profile · Link to this post
Thank you for your answer, it helps me a lot!

But how can I tell dokuwiki to regenerate the cached js.php? I think it does'nt read my script, but it's on the right place with the right name i think.

Thank you!!
Pascal
ChrisS #4
Member since Sep 2006 · 82 posts
Group memberships: Members
Show profile · Link to this post
DokuWiki caches a lot of stuff and there are several ways to trigger a cache refresh.  Probably the easiest is to add "?purge=1" to any wiki url.  For more details see page on caching.

For JS and CSS updates you will most likely also need to force your web browser to refresh its cache.  Shift+Refresh or Ctrl+Refresh is normally sufficient.  Which one will work will depend on your browser and OS.
pascal #5
Member for 2 months · 3 posts
Group memberships: Members
Show profile · Link to this post
Hi ChrisS,

it works! Thank you!!!!

What is the best way to "transport" information from syntax.php to script.js?
I would like to pass same parameters to the script.sh. The only way i can imagine is to create a file and download this file with the scipt, but i think this is not very nice.

Thanks for your help!!!!
Pascal
ChrisS #6
Member since Sep 2006 · 82 posts
Group memberships: Members
Show profile · Link to this post
I think it would depend on what you want to pass.  The simplest method is to have your syntax plugin output a small amount of javascript in the page.  E.g. take a look at the googlemaps plugin.  A more complex method is to have the syntax plugin write metadata rather than (or as well as) xhtml.  An action plugin can retrieve the metadata and generate JS for placement in the HEAD by responding to appropriate events.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please note the verification code from the picture into the text field next to it.
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, 1.6.4, © 2003-7 by Yves Goergen
Current time: 2008-05-17, 06:19:41 (UTC +02:00)
WikiForumIRCBugsTranslate