The joy of writing plugins

18 years 3 months ago #791 by LaSchmoove
The joy of writing plugins was created by LaSchmoove
Hi everybody,

I'm just trying to understand the basic plug-in techniques in order to be able to write my own plug-in soon. In the moment I am a little bit confused about the basic program flow. For example the cb.mamblogtab.xml specifies a getAuthorTab to be used, but in the corresponding cb.mamblogtab.php there is only a class getBlogTab defined.:( Where do I find the connection?

Although I've read the "plugin Framework API" (maybe not often enough?) I did not really understand, which interfaces need to be implemented and where the plugins connect to the existing CB framework.

I hope that someone can show me the missing link, so that I can contribute my plugin soon...

Thank you and enjoy your day,
B.

Please Log in to join the conversation.

18 years 3 months ago #813 by beat
Replied by beat on topic Re:The joy of writing plugins
LaSchmoove wrote:

Hi everybody,

I'm just trying to understand the basic plug-in techniques in order to be able to write my own plug-in soon. In the moment I am a little bit confused about the basic program flow. For example the cb.mamblogtab.xml specifies a getAuthorTab to be used, but in the corresponding cb.mamblogtab.php there is only a class getBlogTab defined.:( Where do I find the connection?

Although I've read the "plugin Framework API" (maybe not often enough?) I did not really understand, which interfaces need to be implemented and where the plugins connect to the existing CB framework.

I hope that someone can show me the missing link, so that I can contribute my plugin soon...

Thank you and enjoy your day,
B.


There is unfortunately no connection, but a small typo without other effects than making it ununderstandable.

This line of the xml file:

[code:1] <tab name="_UE_AUTHORTAB" description="_UE_AUTHORTAB_DESC" class="getAuthorTab" cbfields="0">[/code:1]

should be:

[code:1] <tab name="_UE_BLOGTAB" description="" class="getBlogTab" fields="0" position="cb_main" displaytype="tab">[/code:1]

The plugin XML file is used mainly at plugin installation, and that core tab is preinstalled elsewhere. :whistle:

Sorry about that. I corrected it already for the next release.

You should take a looke at the SimpleBoard tab as a more complete example.

Please also download the plugin API documentation (30+ pages PDF file available at developer.joomla.org in our project for download (you need to be logged-in there to see it), and read it through. It will hopefuly give you the missing links.

If you still have problems, you can post on this thread (I subscribed to it).

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

18 years 3 months ago #821 by LaSchmoove
Replied by LaSchmoove on topic Re:The joy of writing plugins
Hi Beat,
thank you for your answer. Really appreciate it. I've got the API documentation and I think I understood the basic priciples. There are two things (at the moment, I'm sure it will get worse...) I'd like to ask you:

1.
In my plugin's *.php file I need to overload the cbTabHandler::getDisplayTab() function. Who or which class does call this function? And on which event? And how does CB know which class to use, if the class Attribute in the XML file is irrelevant?

2.
The MyClass::getDisplayTab() function will draw the CONTENT to be displayed in a tab. But where can I define that an enclosing tab is drawn?

Thanks again for your support!

B.

Post edited by: LaSchmoove, at: 2005/11/28 20:39

Please Log in to join the conversation.

18 years 3 months ago #865 by beat
Replied by beat on topic Re:The joy of writing plugins
LaSchmoove wrote:

1.
In my plugin's *.php file I need to overload the cbTabHandler::getDisplayTab() function. Who or which class does call this function? And on which event? And how does CB know which class to use, if the class Attribute in the XML file is irrelevant?

As already said, the class attribute in the XML file is very relevant at install time... This info is then stored in the comprofiler_plugin table. You can see that the entry is correct there also for the blog tab ;)

This database entry is used to determine your class when a user profile gets displayed to call your getDisplayTab() method of your class.

2.
The MyClass::getDisplayTab() function will draw the CONTENT to be displayed in a tab. But where can I define that an enclosing tab is drawn?


The enclosing type of your content and its postion on the user profile is determined by ... the site admin, and stored by CB in the comprofiler_tabs table.

Your XML file can specify the default display type and position in the same <tab... line :)

The corrective xml line given in my previous post says display as tab in the main tab aera.

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

18 years 3 months ago #884 by LaSchmoove
Replied by LaSchmoove on topic Re:The joy of writing plugins
I just saw my first Tab:cheer: ! Thank you very much for your help!

But just to better understand the system, could you please tell me which classes are responsible for finding registered tabs and content (meaning classes derived from cbTabHandler) from the comprofiler_plugin table?

Thank you again,

B.

Please Log in to join the conversation.

18 years 3 months ago #932 by beat
Replied by beat on topic Re:The joy of writing plugins
LaSchmoove wrote:

I just saw my first Tab:cheer: ! Thank you very much for your help!

But just to better understand the system, could you please tell me which classes are responsible for finding registered tabs and content (meaning classes derived from cbTabHandler) from the comprofiler_plugin table?

Thank you again,

B.


You are welcome :) ! Congrats for your first tab B) ! What's your your plugin function, by the way ;) ?

The core CB functions are responsible for finding the right content and functions to display. Most of those are in plugin.class.php , but are instanciated/used from other files or core classes of comprofiler.class.php . I'm sorry that I don't have time to write a more detailed internal CB design documenation for now, but most of new code is now documented inside all those files.

Nevertheless, the API documentation should be sufficient for implementing a plugin.

Feedbacks and complements to the API and to that documentation are really welcome.

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.274 seconds

Facebook Twitter LinkedIn