... the last two <style></style> tags are failing xhtml validation... these tags are definitely being inserted by the loader::element .... I've looked thru the header_required.php file but can't find whats producing these empty style tags.... any ideas...??
...I've looked on a couple of other peoples 5.3.3.1 sites and they have the same issue !!
I'm pulling my hair out with this... my client demands XHTML Validation which I can't deliver since upgrading to 5.3.3.1 and I have no idea what's generating these empty style tags...
...of how the designer for blocks adds the styles to the headerItems[]. i would prefer if the current collection is checked for blocks and the related stylesheets are in seperate css files at concrete/css/ and included if a block of a specific type exists in the collection..
...it seems this line outputs any block style headers into the page header. Unfortunately there is no check to see if the $blockStyleHeader variable actually contains data before writing to the header. In my case this means that empty tags are produced which then fails XHTML validation.
my solution was to wrap lines 58 & 59 with an 'if' statement.
Firstly, I found Jimbo's comment very helpful; however, I think his instructions could be clarified a bit for us non-php guru's.
I fixed the validation error by modifying block_styles.php and uploading the file attached below to my server. Here's what I did:
1. In your block_styles.php file, highlight lines 55-60.
2. Replace lines 55-60 with the following code:
?> <?php//add to header$v= View::getInstance();if($blockStylesHeader!=''){$v->addHeaderItem("<style> \r\n".$blockStyleHeader.'<style>','CONTROLLER');self::$headerStylesAdded=1;}?><?php}
3. Save the file and upload it to its original location:
\concrete\models\block_styles.php
This is how I fixed the validation issue. THAT SAID, I know *very little* about php and can almost guarantee that the manner by which I did this is incorrect when speaking of semantic php. If anyone would like to attach their block_styles.php code that does it the right way, then please do so. In either case, if you use the provided code, it works to fix the style type validation issue.
An additional note: If you use this method to validate your page, you cannot put styles in via the C5 interface. It will break your page should you try it.
Congrats ringo, that was totally the way to fix that issue.
I had originally tried to fix it by using that method; however I used a double quote (") instead of a single quote ('). The double quotes--what's traditionally round on type declarations--returned a php error whilst your single quotes validate perfectly.
@Remo: If we use jimboJetset's code, users are unable to insert custom styles via the "Design" button when you are logged in and click on a block. Concrete tries to insert your custom CSS into the head without any surrounding style tags and then it totally breaks the page (page turns white, in turn you have to completely delete it and then re-make the page). Yikes!
That said, if you don't have to insert any styles via the interface, Jimbo's way likely would be the way to go.