Loading...
 
Features / Usability

Features / Usability


Extracting Plugin Parameters

posts: 101
How do I access the parameters passed into a Plugin? When I try to output $params in the php script, all I see is "Array". If I try to output $params0, I get an undefined "offset" error. Ideas? I've checked the doc's but they don't shed a lot of light on how to do this... unless I missed the link or something.
posts: 80 Austria

You could have lokked into the existing plugins eek, like e.g. lib/wiki-plugins/wikiplugin_quote.php

Copy to clipboard
extract ($params,EXTR_SKIP);

This extracts the parameters so you can use them like this:

{CODE()}if (!empty($replyto)) ...
Copy to clipboard


posts: 3665 United States

Simply test for it. For example, if your plugin is:

Copy to clipboard
{MYPLUGIN(foo=xxx)}some text{MYPLUGIN}


Your code may look like:

Copy to clipboard
... if (isset($foo)) { ..do something... } else { ..do somehting else... } ...



HTH,

Rick

posts: 101
Thanks, Ricks - that did the trick again. I see, though, that the docs actually *do* cover how to do this, so sorry for bothering everyone over it.

posts: 101
Ok, nvm folks. Figured out what the problem was. I was trying to output a div tag on the same line as the Tiki tag, all I needed to do was output a line feed in the string between the div and quicktag and that got it working ok.

Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting