techutopia
Total posts: 202
15 Oct 2016 15:41

Hi,

I am trying to write a plugin.

All works fine on the front end, but in the backend I go to:

/administrator/index.php?option=com_cobalt&view=records or /administrator/index.php?option=com_cobalt

... there's an error:

"Cannot redeclare class CobaltViewRecords in /home/admin/web/deomain.com/public_html/components/com_cobalt/views/records/view.html.php" on line 1022

If I turn the plugin off, no error. I can't quite understand why the error appears in admin area ... and I have not altered view.html.php.

Any and all advice appreciated.

Thanks,

Dale.

Last Modified: 19 Oct 2016

Comments have been disabled for this article and works only in read only mode.

techutopia
Total posts: 202
18 Oct 2016 15:31

My plugin only needs to work when people are viewing records on the front end, and it's fine. So, maybe a better question is ... is there a way to stop it running in administration?

Thanks,

Dale.


pepperstreet VIP
Total posts: 3,837
19 Oct 2016 01:23

techutopia My plugin only needs to work when people are viewing records on the front end, ... ... is there a way to stop it running in administration?

I have found something about the JApplication object. Maybe a start for you?

$app = JFactory::getApplication();  
$inAdmin = $app->isAdmin();  
$inSite = $app->isSite();

techutopia
Total posts: 202
19 Oct 2016 07:49

That's fantastic, works good. Thanks for your time. :-) Dale.

Powered by Cobalt