cphalcon
cphalcon copied to clipboard
[NFR] HTML/XHTML options for Phalcon\Tag
As a default, Phalcon creates tags with using XHTML standard. It would be nice to have an option to disable/enable it.
Also, there may be "doctype" option so Phalcon\Tag can determine which standard will be used. We can also use "doctype" property in our views/layouts too.
For example:
/* doctype way */
\Phalcon\Tag::setDoctype("html4"); // html4-strict, html4.01, etc.
\Phalcon\Tag::setDoctype("html5");
\Phalcon\Tag::setDoctype("xhtml1-transitional"); // xhtml1, xhtml1-strict, etc.
So we can use getDoctype() method like getTitle() method in our views too:
<?php echo \Phalcon\Tag::getDoctype(); ?>
<html>
<head>
<title><?php echo \Phalcon\Tag::getTitle(); ?></title>
</head>
....
Another solution may be just xhtml/html toggle (personally i don't like this way).
\Phalcon\Tag::setXhtml(true); // or false - default can be true
And another solution may also be additional option for every tag (against DRY principle?)
echo \Phalcon\Tag::textField(array("example_field", "size" => 10, "xhtml" => false));
Great idea!
+1
PR is merged. Closing.