Reputation: 3364
I want to write the plugin that simply displays "PAGE MOVED" text instead of page.
I have made a folder myPlugin
.
Inside, I put myPlugin.xml
:
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="system">
<name>myPlugin</name>
<creationDate>Creation date</creationDate>
<author>Your name</author>
<authorEmail>Your e-mail address</authorEmail>
<authorUrl>Your website</authorUrl>
<copyright>Copyright information</copyright>
<license>All rights reserved.</license>
<version>Version of the plugin</version>
<description>Description of the plugin</description>
<files>
<filename plugin="myPlugin">myPlugin.php</filename>
</files>
</extension>
And myPlugin.php
:
<?php
defined('_JEXEC') or die('Restricted access');
class myPlugin extends JPlugin{
public function __construct(& $subject, $config){
parent::__construct($subject, $config);
$this->loadLanguage();
}
public function onAfterRoute() {
die("PAGE MOVED"); //no effect
}
public function onAfterRender() {
die("PAGE MOVED"); //no effect
}
public function onBeforeRender(){
die("PAGE MOVED"); //no effect
}
};
I made a myPlugin.zip
from it.
Than I have installed it via Joomla Extension Mannager (success), than enabled it (success).
But when I go to any of my pages, I see no effect of myPluing
.
What else I have to do to see the effect?
I have disabled cache.
Upvotes: 1
Views: 44
Reputation: 3731
The class is not named correctly. For Joomla to call a method of your plugin's class, it has to follow the standard naming convention. Based on your xml file, you have created a system plugin, so the class should be named as follows:
class plgSystemMyPlugin extends JPlugin{
That should make it work (i.e. die often)!
Upvotes: 1