Re: [SMARTY] standart plugin(s) suggestion
| From: | Matthias Mohr | Date: | Wed, 19 Feb 2003 13:30:17 +0000 |
| Subject: | Re: [SMARTY] standart plugin(s) suggestion | ||
| References: | 1 2 3 4 5 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7864@lists.php.net to get a copy of this message | ||
> Servus nochmal, :-)
Selber Servus :-)
> Okay, now all single numbers (2,3,4) are replaced with the correct versions
> (2.0, 3.2, 4.01). Other versions are not supported because I cannot find any
> information if they ever where official. If you want you can set version =
> "5.00".
> Then it will be outputted but no DTD etc. is set by default for obvious
> reasons.
This is fine!
> > It's OK to have the Transitional as default, that's not what I wanted to
> suggest.
> > I meant that if somebody calls the plugin with
> > $dtd = true, $html="HTML" and $version="4.01" and $type=""
> > then you should produce a strict-DTD string.
>
> Mhmm... but instead of calling it with $dtd=true, $xhtml=false, $version=4
> and
> $type="" it would be alot simpler to use {html_doctype type="Strict"} ;-)
what about that call:
{html_doctype type=""}
this leads to the described situation, because the other values can keep their
defaults...
So I would suggest to write that part like this:
------------------------------------------------------------------------------
if ($dtd === true) {
// Add default DTD
if ($version == "4.01" && !empty($type) && strtolower($type) ==
"transitional")
$dtd = "http://www.w3.org/TR/html4/loose.dtd";
else if ($version == "4.01" && !empty($type) && strtolower($type) ==
"frameset")
$dtd = "http://www.w3.org/TR/html4/frameset.dtd";
else if ($version == "4.01" && empty($type))
$dtd = "http://www.w3.org/TR/html4/strict.dtd";
else
$dtd = ""; // no default DTD
}
if ( empty($type) || $strlower($type) == "strict" )
$header .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML $version//EN\"";
else
$header .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML $version
$type//EN\"";
------------------------------------------------------------------------------
Then the string is also correct, if somebody sets the type to an empty string.
And it also does not print out the "Strict"-type...
> > BTW: I'm not sure if the string "Strict" as type is officially allowed
> You're right again. Haven't recognized this :-/
>
> I didn't though it could get such complicated 8-)
:-)
Nothing is easy in Webprogramming and even if things have been well defined,
the real life implementations are different ...
with regards,
Matthias