MyBB Community Forums

Full Version: htmldoctype
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've been looking at creating a custom theme and so I looked at Default Templates -> Index Page Templates -> index

and what I see listed in the first few lines are:
<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
<script type="text/javascript">

However, when I look at the source code for the index page of my forum, I see this as the html tag:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!-- start: index -->
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hell's Kitchen Forums</title>

It seems as if the doctype is coming from the Default Templates -> Ungrouped Templates -> htmldoctype template. However, I don't see it get called by the code above.

Shouldn't Default Templates -> Index Page Templates -> index then have
{htmldoctype}
at the top of it, before the
<html>
so that it would look like this:

{htmldoctype}
<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
<script type="text/javascript">

How/why does the {htmldoctype} get called?

Thanks in advance.
The htmldoctype is added at parse_page(); (used by output_page();):
function parse_page($contents)
{
	global $lang, $theme, $mybb, $htmldoctype, $archive_url, $error_handler;
...
	if($htmldoctype)
	{
		$contents = $htmldoctype.$contents;
	}
	else
	{
		$contents = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n".$contents;
	}
...
	return $contents;
}

Global page line #~527:
// Set up some of the default templates
eval("\$headerinclude = \"".$templates->get("headerinclude")."\";");
eval("\$gobutton = \"".$templates->get("gobutton")."\";");
eval("\$htmldoctype = \"".$templates->get("htmldoctype", 1, 0)."\";");
eval("\$header = \"".$templates->get("header")."\";");
Oh, nvm. I understand now. So it gets called automatically for any page then?

Are there any other special-case templates that get called automatically?
MyBB doesn't particularly follow the MVC model in the 1.x branch. A lot of our code has been adapted from the days of PHP4 through natural progression.
(2012-08-29, 11:15 PM)euantor Wrote: [ -> ]MyBB doesn't particularly follow the MVC model in the 1.x branch. A lot of our code has been adapted from the days of PHP4 through natural progression.

Thanks. I kinda figured that, that's why i changed my post. Smile