Hi all,

I want to use HTML 5 Doctype in my theme. I know that we can change it in html.tpl.php. But I wnat to change it through preprocess. I have search a lot and find a bit of code for it.

Which is following:-

template.php

function ies_preprocess_html(&$variables) {
   if (module_exists('rdf')) {
     $variables['doctype'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML+RDFa 1.1//EN">' . "\n";
     $variables['rdf']->version = ' version="HTML+RDFa 1.1"';
     $variables['rdf']->namespaces = $variables['rdf_namespaces'];
     $variables['rdf']->profile = ' profile="' . $variables['grddl_profile'] . '"';
 } else {
     $variables['doctype'] = '<!DOCTYPE html>' . "\n";
     $variables['rdf']->version = '';
     $variables['rdf']->namespaces = '';
     $variables['rdf']->profile = '';
 }
}

<strong>html.tpl.php</strong>

<?php print $doctype; 

print $language->language; dir=" print $language->dir; " print $rdf->version . $rdf->namespaces; >
print $grddl_profile; ">
print $head;
print $head_title;
print $styles;
print $scripts;

print $classes; " print $attributes;>

print $page_top;
print $page;
print $page_bottom;

But drupal showing following error:-

Strict warning: Creating default object from empty value in ies_preprocess_html() (line 44 of C:\xampp\htdocs\rajnish\ecm\sites\all\themes\ies\process\theme.php).

Please help me. I am newbay.

Any help would be highly appreciated.

Thanks,
Rajnish Rao.

Comments

imranweb’s picture

I would suggest to change the Doctype in html.tpl.php page of your theme.
It would be separate from logic.

-Imran