简体   繁体   中英

Joomla 3 plugin to override class JMenuSite

I'm trying to override a class JMenuSite "libraries/cms/menu/site.php". I created a plugin system jmenusite.php

<?php
defined( '_JEXEC' ) or die( 'Restricted access' );

class plgSystemJmenusite extends JPlugin{

    public function  onAfterRoute () {
        require_once(JPATH_SITE.'/plugins/system/jmenusite/site.php');
    }
}
?>

I copied the files site.php in the folder of the plugin.

Joomla performs the original class and then gives me error: Fatal error: Cannot redeclare class JMenuSite

How can I override the existing class?

Check whether this class name is already in use or not. If it's there choose another class name. We can't use same class name twice when another plugin is activated with same class name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM