W3C Valid Pages - Or as close as we can get.

Permalink
I am on my second C5 site here (very happy), and In effort to have as valid of a document/page as possible I am running into an issue that is two-fold.

1. HTML Formatting Tags in the head of the document
2. CSS tags in the body (primarily the @import/include statements for page_controls.php)

I prefer to stay outside the "/concrete/elements" directory and other core directories for all the obvious reasons, but I find myself unable to resist modifying two files .

1. /concrete/elements/header_required.php
2. /concrete/elements/page_controls.php

"/concrete/elements/header_required.php" has a require() function near the end that processes "/concrete/elements/page_controls.php" and dumps HTML and CSS/JS includes into the head of the document. The CSS/JS output is fine, but the HTML is invalid and unwelcome for my purposes in the head of the document.

So my solution has been to:

1. move the page_controls.php require() function to the first line within the body of my template.
2. remove the CSS/JS statements from page_controls.php and move them to header_required.php where the original require function was.

Do you see any chance that changes similar to these could make it into the C5 core?

vercasson
 
ScottC replied on at Permalink Reply
ScottC
now qualifying for free blocks with contributing help toward w3c compliance, now there is an idea.
synlag replied on at Permalink Reply
synlag
Good idea!

you will never get a site validated because of the style tags which are included when you add for example a rss block.
andrew replied on at Permalink Reply
andrew
In the latest c5 version, 5.2rc1, it's now possible for blocks to inject their code into the header of the page, instead of just inline. I'll document this more in the coming days, but it IS possible. Now, I'm not sure when we'll actually get around to rewriting the blocks to take advantage of this :-) but it is there!
vercasson replied on at Permalink Reply
vercasson
This will be very helpful!
Remo replied on at Permalink Reply
Remo
as I already wrote Andrew, I might take care of this.. I don't promise I'll fix all the blocks but I'm sure I can fix a couple of them soon!
ScottC replied on at Permalink Reply
ScottC
emailed you the code.
synlag replied on at Permalink Reply
synlag
Something like this should work for any css in blocks to be appended in the header.

<script type="text/javascript">
$(function()  
{
// css to header
var cssToHead = "<style type='text/css'>";
cssToHead += ".rssSummaryList .rssItem{ margin-bottom:16px }</style>";
      $("head").append(cssToHead);
   });
</script>
vercasson replied on at Permalink Reply
vercasson
Happy to see this post getting attention.