【发布时间】:2016-05-08 09:58:55
【问题描述】:
我想在 Joomla 2.5 中制作一个插件来更改已保存文章的标题。不幸的是它不起作用... onPrepareContent 效果很好,但我想做 onContentSave...
gcm.php
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
class PlgContentGcm extends JPlugin {
public function __construct(& $subject, $config) {
parent::__construct($subject, $config);
$this->loadLanguage();
}
public function onContentAfterSave($context, &$article , $isNew) {
$article->title = "Hello world!";
return false;
}
}
?>
gcm.xml
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="content">
<name>plg_content_gcm</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>2.5.0</version>
<description>DESC</description>
<files>
<filename plugin="gcm">gcm.php</filename>
<filename>index.html</filename>
</files>
</extension>
也许有人可以帮助我。插件已安装并激活。
【问题讨论】:
标签: joomla joomla2.5 joomla-extensions