For documentation on building Joomla! plugins, see this page
.All this plugin will do is add a link to the Linkr window. Links are added on the server side (see plugin events). Have a look at the PHP plugin file:
<?php // Block direct access to this file defined('_JEXEC') or die('Restricted'); // Plugin libraries jimport('joomla.plugin.plugin'); // Foo plugin example class plgContentFoo extends JPlugin { function plgContentFoo( &$subject, $config ) { parent::__construct( $subject, $config ); } /* * Linkr links */ function onLinkrGetLinks( $version ) { // Alert the current version of Linkr $msg = 'Foo is installed on Linkr '. $version; // Since this will be added to the "onclick" // attribute, use 'single quotes' instead // of "double quotes" $js = "LinkrHelper.test('". $msg ."')"; // Return link title and javascript statement return array( 'Link Foo' => $js ); } }This will add a link Link Foo to the Linkr window. When the link is clicked, a popup message will show the current version of Linkr (see the docs for LinkrHelper.test).
Now, have a look at the XML install file:
<?xml version="1.0" encoding="utf-8"?>It's important that the group attribute of the install tag be set to content, or your plugin won't be able to communicate with Linkr.<install version="1.5" type="plugin" group="content"><name>Content - Foo</name> <version>Tutorial</version> <creationDate>July 2009</creationDate> <description> Foo Plugin - Don't forget to activate the plugin! </description> <files> <filename plugin="foo">foo.php</filename> </files> <params/> </install>
Get the complete plugin and give it a try!
Compatible: Linkr 2.0+, Joomla! 1.5.1+
| < Prev |
|---|



