Wednesday, 26 November 2014 15:13
beggarly

porting old plugins to work with latest xmap

An open forum for opinions and general questions

porting old plugins to work with latest xmap

Postby aniphreak » Sat Jan 17, 2009 4:13 pm

can this be done by changing some codes or a total rewrite must be done...

any explanation for this?
aniphreak
Fresh Boarder
Fresh Boarder
 
Posts: 12
Joined: Sat Jan 10, 2009 9:32 pm

Re: porting old plugins to work with latest xmap

Postby guilleva » Mon Feb 09, 2009 4:07 pm

Hi, you can use the same code and made some adjustments. A brief description you need to do is:

- Rename the class name to xmap_com_xxxxx
- Add a third parameter to the function getTree which will contain the parameters for the plugin defined in the xml file (if any)
- The plugin doesn't return an array with the nodes anymore, you should call the function $xmap->printNode($node) when the node is ready to be printed.
- You should use the functions $xmap->changeLevel(1) to go up one level in the tree structure and $xmap->printNode(-1) to go down.
- Define a new property to the node to be printed: $node->uid which is an unique id for the node within the current component. This should be unique for each node. Eg.
$node->uid = $parent->uid.'c'.$row->category_id; //For a category
$node->uid = $parent->uid.'p'.$row->product_id; //For a product


The easiest way to do it is taking another plugin as example.
User avatar
guilleva
Administrator
Administrator
 
Posts: 1527
Joined: Wed Sep 12, 2007 3:10 am
Location: San José, Costa Rica

Re: porting old plugins to work with latest xmap

Postby aniphreak » Mon Feb 09, 2009 4:19 pm

:shock: :shock: :shock: :shock:
*nosebleeds*
aniphreak
Fresh Boarder
Fresh Boarder
 
Posts: 12
Joined: Sat Jan 10, 2009 9:32 pm


Return to General



Who is online

Users browsing this forum: No registered users and 2 guests

cron