Core css loading when not logged in

Permalink
Even after I've signed out, the core concrete5 css seems to be loading and is affecting the bootstrap.css for responsive.

http://www.state-street.org/

Any ideas on what might cause this?

 
mnakalay replied on at Permalink Best Answer Reply
mnakalay
That is a normal C5 behaviour.
You will find the reason in concrete/elements/header_required.php

that file is responsible for putting in the header everything that's required including meta tags, default css files, jquery...

Aroubd line 66 you'll find
$html = Loader::helper('html');
$this->addHeaderItem($html->css('ccm.base.css'), 'CORE');
$this->addHeaderItem($html->javascript('jquery.js'), 'CORE');
$this->addHeaderItem($html->javascript('ccm.base.js', false, true), 'CORE');


This loads jquery, the javascript needed by C5 when using it's interface and the css that goes with it.

A common fix is to copy the file header_required.php to your root elements folder so as to override the original without breaking anything and in tha newly copied file modify the lines like so:
$cp = new Permissions($c);
if (isset($cp)) {
   if ($cp->canWrite() || $cp->canAddSubContent() || $cp->canAdminPage() || $cp->canApproveCollection()) {
$html = Loader::helper('html');
$this->addHeaderItem($html->css('ccm.base.css'), 'CORE');
$this->addHeaderItem($html->javascript('jquery.js'), 'CORE');
$this->addHeaderItem($html->javascript('ccm.base.js', false, true), 'CORE');
}
}


In case you still want jquery to load all the time and the other ones to load only when editing just take jquery out of the condition like so
$this->addHeaderItem($html->javascript('jquery.js'), 'CORE');
$cp = new Permissions($c);
if (isset($cp)) {
   if ($cp->canWrite() || $cp->canAddSubContent() || $cp->canAdminPage() || $cp->canApproveCollection()) {
$html = Loader::helper('html');
$this->addHeaderItem($html->css('ccm.base.css'), 'CORE');
$this->addHeaderItem($html->javascript('ccm.base.js', false, true), 'CORE');
}
}