Achievo/Howto/Developers/Create pim items: Difference between revisions
m Create pip items moved to Create pim items |
|||
| (10 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
{{achievo_howto|Easy|[[Sandy Pleyte]] <sandy@achievo.org>}} | |||
== Intro == | == Intro == | ||
In Achievo it's possible to create [[ | In Achievo it's possible to create [[pim]] items in your own module. As of Achievo 1.2 it's possible for users to choose what [[pip]] items they want to show on the [[pip]]. This howto explains how to accomplish this. | ||
== Achievo 1.1 and below == | == Achievo 1.1 and below == | ||
If you want to add a [[ | If you want to add a [[pim]] item to your module, you should extend your module class with the following function: | ||
< | <syntaxhighlight lang="php"> | ||
function getPimItems() | function getPimItems() | ||
{ | { | ||
| Line 18: | Line 13: | ||
} | } | ||
</ | </syntaxhighlight> | ||
If you want more then 1 [[ | If you want more then 1 [[pim]] item, you should collect the result and return it as one variable. | ||
< | <syntaxhighlight lang="php"> | ||
function getPimItems() | function getPimItems() | ||
{ | { | ||
| Line 30: | Line 25: | ||
return $ret; | return $ret; | ||
} | } | ||
</ | </syntaxhighlight> | ||
== Achievo 1.2 and above == | == Achievo 1.2 and above == | ||
In Achievo 1.2 and above it's possible to specify 1 or more [[ | In Achievo 1.2 and above it's possible to specify 1 or more [[pim]] items for a module. To get this result you need to extend your module class with the following function: | ||
< | <syntaxhighlight lang="php"> | ||
function getPimItems() | function getPimItems() | ||
{ | { | ||
| Line 52: | Line 47: | ||
return "Example 2 Pim item"; | return "Example 2 Pim item"; | ||
} | } | ||
</ | </syntaxhighlight> | ||
As you can see in stead of returning the content for the [[pim]], we now return an array with the [[pim]] item name and the function to call. | |||
[[Category:Achievo Howtos]] | |||
Latest revision as of 21:34, 7 June 2008
|
Achievo Howto: Achievo/Howto/Developers/Create pim items
|
Intro
In Achievo it's possible to create pim items in your own module. As of Achievo 1.2 it's possible for users to choose what pip items they want to show on the pip. This howto explains how to accomplish this.
Achievo 1.1 and below
If you want to add a pim item to your module, you should extend your module class with the following function:
function getPimItems()
{
return "This is my Pim Item";
}
If you want more then 1 pim item, you should collect the result and return it as one variable.
function getPimItems()
{
$ret = "";
$ret.= $this->getExample1();
$ret.= $this->getExample2();
return $ret;
}
Achievo 1.2 and above
In Achievo 1.2 and above it's possible to specify 1 or more pim items for a module. To get this result you need to extend your module class with the following function:
function getPimItems()
{
return array("example1"=>"getExample1",
"example2"=>"getExample2");
}
function getExample1()
{
return "Example 1 Pim item";
}
function getExample2()
{
return "Example 2 Pim item";
}
As you can see in stead of returning the content for the pim, we now return an array with the pim item name and the function to call.