cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[NFR] HTML/XHTML options for Phalcon\Tag

Open hdogan opened this issue 14 years ago • 3 comments

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));

hdogan avatar Oct 01 '12 19:10 hdogan

Great idea!

niden avatar Oct 01 '12 20:10 niden

+1

nesbert avatar Oct 03 '12 17:10 nesbert

PR is merged. Closing.

hdogan avatar Oct 18 '12 14:10 hdogan