header_required config for HTML5 or XHTML in 5.7

Permalink
Wouldn't it be nice if we could be able to specify at least part of the output of Loader::element('header_required') to enable developers choose or switch the doctype they prefer to code in especially since IE 7/8 doesn't support HTML5 without javascript injection.

I still develop some sites with XHTML 1.0 because some clients still insist on support for old browsers like IE 7/8 as they are still widely in use. Hope this ground breaking version adds some way to control what gets between the
<head></head>
tags or allow switching some parts with custom code.

Martin

 
mhawke replied on at Permalink Reply
mhawke
As far as I can tell, doctype is determined by your theme files.

You can override header_required.php by copying it from 'concrete/elements/header_required.php' and putting it in 'application/elements/header_required.php'.

Make sure your caching has 'Overrides Cache' turned off in Dashboard->System and Settings->Cache and Speed Settings so c5 will look in your application folder.

I think you will find that header_required.php doesn't really determine what HTML gets into the <head> section. It's mostly stuff that concrete5 uses internally.
martbase replied on at Permalink Reply
Thanks mhawke. I am aware I can specify the doctype in the theme's header.php but concrete5 still spits code like
<!--[if lt IE 9]>
<script src="/c5dev/updates/concrete5.7.2/concrete/js/ie/html5-shiv.js"></script>
<script src="/c5dev/updates/concrete5.7.2/concrete/js/ie/respond.js"></script>
<![endif]-->
which is html5 specific and there is no way of suppressing or including different scripts other than overriding the header_required.php.

Overriding header_required.php may not be the best solution always as updates to the core may modify concrete's header_required and the changes will not be reflected in the custom override. I was thinking more of a way of extending header_required or allowing some of its output to be configured by the developer.

Martin
mhawke replied on at Permalink Reply
mhawke
That's the problem with all overrides. You have to check the new version for any changes that might affect your decision to override. And header_required.php is a major file to be overriding. I would certainly think twice before doing it. I'm not sure there is enough demand for developing for old browsers to make it worth the effort. I tell my clients that I triple my rates if they ask me to make things compatible with old IE versions.
andrew replied on at Permalink Reply
andrew
I don't get it. You shouldn't have to override header_required.php. Doctype is set at the very top of the template. header_required.php only includes a few items that come inside the <head></head> tags.
martbase replied on at Permalink Reply
Thanks andrew and mhawke.

Let me elaborate, concrete5 still loads html5 specific "html5-shiv.js" for IE regardless of the doctype specified in the template.
I was thinking of a config setting that would conditionally determine the script(s) included/excluded or maybe an array that developers could use to specify the scripts and/or css for older (IE7/8) browsers.
Alternatively developers could drop support for IE 7/8, follow mhawke's suggestion and start developing only for modern browsers. Just wondering if concrete 5.7 is dropping support for HTML4/XHTML1.
Considering that a fresh install of Windows 7 comes with IE8 bundled this could mean some non-tech users would get a different experience for sites we develop.
mhawke replied on at Permalink Reply
mhawke
Browser upgrades are free. Making things work on IE8 definitely is not free. Win7 isn't available on very many new computers so folks who install Windows 7 are very likely doing it deliberately and they know they are installing an older OS. They will likely be prompted to upgrade all sorts of programs including IE8. While I understood why some companies wanted to stick with IE6, there really isn't any excuse for anyone to be on IE8 today.
andrew replied on at Permalink Best Answer Reply
andrew
Ah, I see. Yeah, we should probably make that a configurable setting that defaults to true but can be turned off.
andrew replied on at Permalink Reply
andrew
Just an update to this: we will be moving html5-shiv and respond.js from out of header_required.php and into our core theme headers in 5.7.4. This means that third party themes will have to start including it in their headers as well (if they want to keep this functionality) . Just a heads up to keep your theme updated so that they don't break when 5.7.4 is installed.
martbase replied on at Permalink Reply
Noted.

Thanks Andrew. We are eagerly waiting for the next update to 5.7.2.1, when is it due. I have been checking almost daily on concrete5.org and even monitoring the milestones on github.