Jueves, 29 Enero 2015 10:18

How to get started developing a plugin?

Suggest/Comment/Post new extensions for Xmap!

How to get started developing a plugin?

Postby Prova » Thu Nov 04, 2010 10:23 pm

I'd like to develop an XMap extension to add my custom components to my site's sitemap. Does anyone know where to start? Is there documentation anywhere? I've seen several people ask for it, but no responses.

The current extensions seem to have a system to it, but it will take forever to figure it out on my own.

I'd like to start with a simple extension that lists every user's profile URL in my xml sitemap.

Here's my current sitemap: http://prova.com/advertising/sitemap
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: Thu Nov 04, 2010 10:19 pm

Re: How to get started developing a plugin?

Postby bojanpopic » Sun Nov 14, 2010 10:05 pm

I had same problem as you. And the best way is just playing with some existing plugin. Pick something simple (less code) that work with something what is familiar to you (some joomla extension you have knowledge how it works). I think I tried with plugin for contact component of joomla. It's developed by guilleva so it's best practice and work with core joomla component that is fairly simple.

Oh... alse use J!Dump plugin. It's just priceless. Make copy of plugin you want to play with. Just dump xmap object or item object or whatever you like and you can easy pick up what is what. You can see objects and better understand how xmap works.

I can tell you that acctual map is "printed" like this:
Code: Select all
// now we print categories
         foreach($cats as $cat) {
            $node = new stdclass;
            $node->id   = $parent->id;
            $node->uid  = $parent->uid .'c'.$cat->id;
            $node->name = $cat->name;
            $node->link = 'index.php?option=com_zoo&task=category&category_id='.$cat->id;
            $node->priority   = $params['cat_priority'];
            $node->changefreq = $params['cat_changefreq'];
            $node->expandible = true;

And if you want something just in your html map use if (xmap->view="html"). Or view=xml. News map is checked with xmap->isNews. That should be enough for you to start. Of Don't forget J!Dump!!!

P.S. You can use my zoo plugin for learning if you familiar with zoo CCK. I tried to document some things for myself so it's not "documented" but it's not just bare code. Find it on the forum.
Fresh Boarder
Fresh Boarder
Posts: 19
Joined: Wed Jul 21, 2010 12:04 am

Re: How to get started developing a plugin?

Postby Prova » Tue Dec 07, 2010 7:34 pm

Update: I played around & figured this out: I have to rename the extension to the same name as the component. Now I'll just sort out what everything inside the extension does :D

Original: Any advice on how to get the plugin to start? I use dump() (love this app), & I put it at the very top of every function, reload the sitemap, & nothing dumps (definitely not dump problem, as I know how to use it very well).

It's like there's some trick with xmap to make it execute each extension???

If you could point me to the start, it would be very helpful.

I'm editing your plugin (beta 4 I think, that's the latest number in the changelog), and see 3 functions:

I don't have Zoo CCK installed, so can't test that part. The only extension I do have installed is Kunena (& the kunena extension works fine).

It would make sense that Xmap loads the com_zoo extension & then runs an initial query to check whether it should continue or not. Apparently that's not it?

Fresh Boarder
Fresh Boarder
Posts: 2
Joined: Thu Nov 04, 2010 10:19 pm

Return to Plugins

Who is online

Users browsing this forum: No registered users and 1 guest