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

extract ($params,EXTR_SKIP);

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

{CODE()}if (!empty($replyto)) ...

posts: 3662 United States

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

{MYPLUGIN(foo=xxx)}some text{MYPLUGIN}

Your code may look like:

if (isset($foo)) {

 ..do something...

} else {
 ..do somehting else... }



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

No records to display