Hooking up with the Tag Words plugin

admin by admin in Blog

A new core plugin has been added to the 0.8 development tree: the tagwords plugin, which you can see in action right here!

A new core plugin has been added to the 0.8 development tree: the tagwords plugin, which you can see in action right here! Just look on the right side and you'll the tagwords menu (which leads you to the full tagwords page as well).
The Tagwords plugin allows you to add tags to item you create. Currently tagwords has been added to news, content, links_page, download and calendar_menu. A form field will be present in the admin pages when creating or editing and item. This has been achieved through the use of the Triggerhook event as described in another post. you can install the plugin through the plugin manager page in your admin area. The admin page of the tagwords plugin has some preferences. These won't be discussed here, but will (in time) be added to the wiki.

A plugin that wants to allow for tagwords to be added needs to have the following requirements:
- first of all it needs to have a correct implementation of the TriggerHook event feature (for more detail see the post on it)
- secondly, it needs to have an e_tagwords.php file in the root of the plugin folder. The e_tagwords.php file consists of a class named 'e_tagwords_myplugin' (in which myplugin needs to be replaced with the real name of the plugin) and two mandatory methods getLink and getRecord (See the core parts mentioned for more detailed examples).

Besides the Tagwords plugin page which displays all tagwords, you can display the tagwords belonging to an item with the item itself as well (eg. beneath a news item). While this has not been added to all core parts by default, the implementation is not too hard. There is a global shortcode within the tagwords plugin you can use to retrieve the specific tagwords for the item. You can do so by using the following call (of course you need to correctly set the myplugintable and myitemid variables):
$mytagwords = $tp->parseTemplate("{TAGWORDS=myplugintable^myitemid}");
of course you can also use the shortcode within your own templates like so:
$SOME_TEMPLATE['somthing'] = '{TAGWORDS=myplugintable^myitemid}'
This will return a list of tagwords belonging to the item in question.


Social Links