Jump to content

Click here to lend your support to: Traq and make a donation at pledgie.com !

Creating Plugins for Traq 2.0

  • Please log in to reply
No replies to this topic

#1 Jack


    Project Founder

  • Administrators
  • 673 posts
  • LocationAustralia

Posted 05 January 2010 - 05:50 PM

Creating Plugins for Traq 2.0 is simple, there are two ways you can do it.

The first is the easiest, which is use the AdminCP to create your plugin and hooks then export it to an XML file.

The second is creating your plugin's XML file and entering your data there.

This is the template for an example plugin file:
<?xml version="1.0" encoding="UTF-8"?>
		<name>Customize Text</name>
		<author>Your Name</author>
		<hook title="global.php hook" hook ="global" execorder="1">
		<hook title="formattext() hook" hook="formattext" execorder="1">
				<![CDATA[if(!$myClass) $myClass = new myClass;
				$text = $myClass->someFunction($text);]]>

Now the install and uninstall SQL parts are for plugins that need to add stuff to the database or remove stuff from the database when uninstalled.

When using these fields, the SQL should be formatted like so:
INSERT INTO table (columnOne,columnTwo) VALUES('cool','plugin');
INSERT INTO table2 (columnOne,columnTwo) VALUES('Traq','I love it');
Each query must end with a ; to separate the queries.

Now as you can see from the example plugin, there are two hooks being added, one to the global hook and one to the formattext hook.

The global hook loads at the end of the global file while the formattext hook loads whenever the formattext() function is used.

A list of hooks will be released towards the release of Traq 2.0

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users