Create min content plugin

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
holden321
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Wed Mar 06, 2013 9:34 pm

Create min content plugin

Post by holden321 » Wed Mar 06, 2013 9:47 pm

Hello I'm trying to create a simple content plugin:
1. I created two files (see below)
2. Installed plugin.
3. Enabled it.
4. It doesn't work at all.
Why? What I'm doing wrong?
name.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<install version="3.0" type="plugin" group="content" method="upgrade">
    <name>plg_name</name>
    <version>1.0.0</version>

    <files>
        <filename plugin="name">name.php</filename>
        <filename>name.xml</filename>
    </files>
</install>
name.php

Code: Select all

defined('JEXEC') or die;
jimport( 'joomla.plugin.plugin' );

class plgContentName extends JPlugin
{
	public function onContentPrepare($context, &$article, &$params, $page = 0)
	{
		$article->text='hello';
		return true;
	}
}

 
TheCellarRoom
Joomla! Intern
Joomla! Intern
Posts: 77
Joined: Wed Jan 02, 2013 10:09 am

Re: Create min content plugin

Post by TheCellarRoom » Wed Mar 27, 2013 9:17 am

Try adding this to your .php file

it will show in your source code to see if plugin is being loaded.

- My plugins are being loaded, but still do not work however.

Code: Select all

$document=JFactory::getDocument();
$document->addCustomTag('<!-- Plugin has been included correctly-->');

 

Locked

Return to “Extensions for Joomla! 3.x”