Im trying to create a plugin to override a Joomla class, which otherwise is impossible to override. Here are my codes:
comoverride.xml
<files>
<filename plugin="comoverride">comoverride.php</filename>
<filename>comoverride.xml</filename>
<filename>index.html</filename>
</files>
<config>
</config>
</extension>
(of course i have my information in my tag and the other necessary information)
comoverride.php
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
jimport('joomla.application.component.helper');
class comcontent extends JPlugin{
public function __construct(&$subject, $config = array()) {
parent::__construct($subject, $config);
}
public function onAfterRoute () {
$app = JFactory::getApplication();
if('com_content' == JRequest::getCMD('option') && !$app->isAdmin()) {
$template = $app->getTemplate();
require_once(JPATH_SITE.'/templates/'.$template.'/code/com_content/models/articles.php');
}
}
Im trying to override the articles.php file, where the class "ContentModelArticles" is in it. but it doesn't seem to work at all unfortunately.
Can anyone please test it for me?