This looks wrong to me. The content of your ``$head`` variable should be placed inside the ``<head>`` tag, not before the doctype