Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Baffled by empty <head> section

Go to End

6 Posts   2881 Views


Community Member, 130 Posts

25 June 2011 at 7:11am

Hi all, I have a very curious issue and I'm absolutely stumped as to why its happening

When I check my site using firebug it shows the head section as empty and the code from it in the body section??? With 2 empty paragraphs that are not in my

When I try to validate on w3c it says "No DOCTYPE found, and unknown root element. Aborting validation" and "No XML declaration (e.g <?xml version="1.0"?>) " but they are both in my

I'm very confused by this and hope someone can help. Thanks for listening :)

This is what shows in Firebug
<html lang="en">



<base href="">
<title>mysite | About</title>
<meta content="SilverStripe -" name="generator">
<meta content="text/html; charset=utf-8" http-equiv="Content-type">

<base href=""><!--[if lte IE 6]></base><![endif]-->
<!--<title>mysite | About</title>
<meta name="generator" content="SilverStripe -" >
<meta http-equiv="Content-type" content="text/html; charset=utf-8" >
<meta content="noindex, nofollow" name="robots">

<link href="-----------------------------------------------------------------------" type="text/css" rel="stylesheet">
<link href="-----------------------------------------------------------------------" type="text/css" rel="stylesheet">

<div id="container">

And this is what my looks like

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns="" xml:lang="en" >
<% base_tag %>

<% require themedCSS(screen) %> 

<div id="container">


Forum Moderator, 5521 Posts

25 June 2011 at 2:13pm

Edited: 25/06/2011 2:14pm

Is the final site using your some other template? I would recommend against using the xml header now and using an HTML5 doctype.


Community Member, 130 Posts

25 June 2011 at 11:25pm

Edited: 25/06/2011 11:47pm

Oh dear, Hi Will,
I just found two paragraph tags at the top of my Home.php page.
I can't believe it. Don't know how I managed to put them there or why I couldn't find them yesterday when I did a sitewide search.

Anyhoo, sorry for the fuss, rest assured my face is red.

Thanks for the help.


Community Member, 7 Posts

7 November 2011 at 5:18am

Edited: 07/11/2011 5:20am

Hi guys,
I got the same problem as described above with the difference I haven't empty paragraphs in my Page.php
Here is my Page.php

class Page extends SiteTree {

	public static $db = array(

	public static $has_one = array(
	function getAboutLink() {
		$menulink = parent::get_by_link('about')->Link();
		return $menulink;
	function getBuyLink() {
		$menulink = parent::get_by_link('buy')->Link();
		return $menulink;

class Page_Controller extends ContentController {

	public static $allowed_actions = array (

	public function init() {

		// Note: you should use SS template require tags inside your templates 
		// instead of putting Requirements calls here.  However these are 
		// included so that our older themes still work

Here is templates/

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html lang="$ContentLocale">
		<% base_tag %>
		<title><% if MetaTitle %>$MetaTitle<% else %>$Title<% end_if %> &raquo; $SiteConfig.Title</title>
		<link rel="shortcut icon" href="/favicon.ico" />
		<% require themedCSS(bootstrap) %>
		<% require themedCSS(layout) %>
		<!--[if lt IE 9]>
			<style type="text/css">
			 @import url(themes/macslaw/css/ie.css);
		<div class="wrapper">
		<!-- Begin Header -->
			<% include TopHeader %>
			<div class="clearfloats"><!-- --></div>
			<% include MainHeader %>
			<div class="clearfloats"><!-- --></div>
		<!-- End Header -->
		<!-- Begin announce-head -->
			<% include AnnounceHeadInner %>
			<div class="clearfloats"><!-- --></div>
		<!-- End announce-head -->
		<!-- Begin Content -->
		<!-- End Content -->
		<!-- Begin Footer -->
			<% include Footer %>
		<!-- End Footer -->

and templates/Layout/

<div class="main-content" id="main-content">
	<div class="container">
		<div class="row">
			<!-- Begin top row -->
			<div class="span17 columns round-box gradientV soft-info" id="soft-info">
				<div class="soft-info-header">
				<div class="soft-info-body">
			<!-- End top row -->

I attach the console from Chrome with the page structure where can see that the head tags are in the begining of the body.
I'm very confused and I lost many hours in research of this "effect". The bigger problem is that in the begining of the <body> tag stays empty string " " which brokes the frontend.

Can anybody help?

Attached Files

Community Member, 7 Posts

7 November 2011 at 9:41pm

I found where the problem is!
It was in the encoding of the source files - SS source files are in ANSI, but my template files - UTF8. Made them equal solves the problem.

Hope this helps somebody.


Community Member, 2 Posts

9 November 2011 at 8:07am


A coder used this CMS a few years ago to build a site that now has gone a bit funny, and it would be great to hear from any SilverStripe pros who can help us fix the site.

This is paid work for a site where the CMS seems to have permissions issues connecting to the database... possibly because a server update/upgrade or some other actions they took. We have a backup of when the site went live, so we can supply all the files that a pro could use to fix it.

Please email Terry [email protected] and Christian Barnes [email protected] to get more details.

If there is a better place for us to post this type of message to recruit developers, please do let us know...

Many thanks
Terry and Christian