Write a Joomla plugin in simple steps.

From last few days i have received many request for the simple steps of writing a Joomla Plugin. So, i am back with the simple steps of writing a Joomla Plugin. As we know Joomla is the most popular CMS in these days. So, becoming a Joomla Plugin developer is also a good idea to earn some money (you can even sell it 😉 ) Joomla plugins are mostly use to find any string pattern in content dynamically and if a pattern is found then we  replace that pattern with what ever we like.

Ok let’s start it in few simple steps,

Step 1. Create a new XML file and write these lines in the file( you can use any text editor but dreamweaver is recommended ).



this is testing plugin
Ankur Sharma
16/08/2010
Wamptech
ankursharma.niit@gmail.com
www.ankursharma.net
1.0
plugin description here






test.php

Step 2. Write the plugin name in between <name>…</name>

and similarly change author, creation date, copyright, author email,author url, version and description.

Step 3. In between the <filename></filename> write a php file name and create a new php file with the same name.

Step 4. Use the following code for its functional part:-

text)  ) {   // return back if [texttobefound] not found in article $row->text
return;
}

$plugin =& JPluginHelper::getPlugin('content', 'test');
$pluginParams = new JParameter( $plugin->params ); 

// Parameters
$opt1     = $pluginParams->get('test_opt1', 'xyz2');
$opt2        = $pluginParams->get('test_opt2', 'abc');

$row->text = str_replace( "[texttobefound]","hi",$row->text);        //replace the content  of article with your value

}
}

?>

Here we are done.
Now, Zip both the files in one and install it by using the Joomla installer.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Privacy Policy · Contact · Sitemap

© 7Tech – Programming and Tech Tutorials