We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

[SOLVED] Can't get get_doctype() to return HTML5

If I set in my controller or view service setup

Phalcon\Tag::setDocType(Phalcon\Tag::HTML401_TRANSITIONAL);

I get the correct document type declaration:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">

If I put in

Phalcon\Tag::setDocType(Phalcon\Tag::HTML5);

I get no return from {{ get_doctype() }} at all.

I can kinda follow the C code, and it looks like HTML 5 declaration is the default if nothing has been declared, but it doesn't seem to be working that way. I have noticed that both of the demo apps forgo the use of get_doctype() and just have the declaration hardcoded. Anyone else seeing this issue? i don't see a bug report for this, but I might have to put one in I guess.



5.3k
Accepted
answer

Looks like the fix for this will be in 1.2.5 via issue/pull request #1667. Until then, I'll just hardcode it.