Weird behaviour... please help!
Permalink
I've been working on a Package for C5. The package contains a block.
The block needs to add some Javascript on the header, only when there's nobody logged in. The reason is that the JS I'm adding to the header is prototype.js which conflicts big time with C5's editmode.
In the beginning I added the following in the __construct function of block controller:
...and it all worked fine for quite a while.
HOWEVER, now I have a massive issue, as two things happen:
1. As soon as I add the block on ANY page, the whole C5 editing mechanism BREAKS as the JS is output ON ALL PAGES, whether they contain the block or not!
2. No matter what I do, even if I comment out the entire code in the controller, it still appears on every page.
I have cleared the cache (both from the dashboard and manually) but to no avail.
I have added the package to another C5 installation and it works fine!
Any ideas???
The block needs to add some Javascript on the header, only when there's nobody logged in. The reason is that the JS I'm adding to the header is prototype.js which conflicts big time with C5's editmode.
In the beginning I added the following in the __construct function of block controller:
global $c; $cp = new Permissions($c); if($cp->canWrite()) { } else { $this->addHeaderItem($html->javascript(($JSpath . '/prototype.js')),'CONTROLLER'); $this->addHeaderItem($html->javascript(($JSpath . '/scriptaculous.js?load=effects')),'CONTROLLER'); $this->addHeaderItem($html->javascript(($JSpath . '/lightbox.js')),'CONTROLLER'); $this->addHeaderItem($html->css(($CSSpath . '/lightbox.css')),'CONTROLLER'); }
...and it all worked fine for quite a while.
HOWEVER, now I have a massive issue, as two things happen:
1. As soon as I add the block on ANY page, the whole C5 editing mechanism BREAKS as the JS is output ON ALL PAGES, whether they contain the block or not!
2. No matter what I do, even if I comment out the entire code in the controller, it still appears on every page.
I have cleared the cache (both from the dashboard and manually) but to no avail.
I have added the package to another C5 installation and it works fine!
Any ideas???