Page 1 of 1

strange behaviour of the <head>-tag (CMSms v2.1.2)

Posted: Fri Feb 05, 2016 10:39 pm
by so what?
I read on a page that the <head>-tag can be omitted in HTML5. So I tried it out by putting it into smarty comments like this

Code: Select all

{* <head> *}
and of course the closing head-tag as well, saving the template, reloading my webpage and Oops! getting an error:
Error: at line 29 in file /.../cmsms/lib/smarty/sysplugins/smarty_internal_templatecompilerbase.php:
with the message:
Syntax error in template "tpl_top:14" on line 29 "{*" - Unexpected "*"

If I put the head into an html-comment like

Code: Select all

<!-- <head> -->
that's fine but if I put this code into smarty comments like

Code: Select all

{* <!-- <head> --> *}
then I get again an Oops! error:
Error: at line 29 in file /.../cmsms/lib/smarty/sysplugins/smarty_internal_templatecompilerbase.php:
with the message:
Syntax error in template "tpl_top:14" on line 29 "{*

If I put the comments the other way around like this:

Code: Select all

<!-- {* <head> *} -->
I get again an Oops! error:
Error: at line 29 in file /.../cmsms/lib/smarty/sysplugins/smarty_internal_templatecompilerbase.php:
with the message:
Syntax error in template "tpl_top:14" on line 29 "

Of course I just could have deleted the <head>-line but I found it a strange behaviour that the <head>-tag cannot be placed inside a smarty comment. This behaviour might point to a hidden bug.
I also noticed that any white space in front of the <head>-tag gets deleted in the output html file. Why is this?

Re: strange behaviour of the <head>-tag (CMSms v2.1.2)

Posted: Fri Feb 05, 2016 11:01 pm
by Jo Morg
so what? wrote:Of course I just could have deleted the <head>-line but I found it a strange behaviour that the <head>-tag cannot be placed inside a smarty comment. This behaviour might point to a hidden bug.
No bug. It's as designed.
You need to understand how CMSMS parses page templates and that you can remove both < head > </ head > but not just one of them as it's not valid HTML in any case.