juliopontes / joomla-override

Plugin to Override Joomla Extensions (Modules and Components)
19 stars 17 forks source link

K2 Controller can not be override #8

Closed jiMuBao closed 10 years ago

jiMuBao commented 11 years ago

K2 Controller can not be override. Fatal error: Cannot redeclare class K2ControllerItem.

juliopontes commented 11 years ago

Can you send me example for testing here, please.

kmgalanakis commented 11 years ago

You can install K2, create a K2 Item and view it from your frontend. I hope you know how to do this.

Then you create a code\com_k2\controllers\item.php

Then you copy past into this file

defined('_JEXEC') or die ;

jimport('joomla.application.component.controller');

class K2ControllerItem extends K2ControllerItemDefault
{
    public function display($cachable = false, $urlparams = array())
    {
        die('This is my override '.__METHOD__.' at '.__FILE__);
    }
}

After that view that k2 item in your front end. It now raises an error. Cannot redeclare class K2ControllerItem etc...

It tries to load the default controller again.

juliopontes commented 11 years ago

Thanks for update I'll test.