Apologize for my bad php knowledge, how to set html5 flag for the current document? Something like:


This to be executed in template.php where we do not have $document.

My template lacks support for this flag, but in head.php we have:

if ($document->isHtml5())
        $buffer .= $tab . '<meta charset="' . $document->getCharset() . '" />' . $lnEnd;

You should be able to do JFactory::getDocument(); in most places within Joomla (component, module, plugin, etc) to get the document object.

And then you are correct, it is a call to setHtml5 like this:

$document = JFactory::getDocument();

This is the function declaration in Joomla's core for reference: https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/document/html/html.php#L337

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.