MyBB Community Forums

Full Version: Change doctypehtml MyBB HTML4 Being HTML5
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Before you understand first what is HTML5 and other functions can be understood in Semantics - Dive Into HTML5
http://diveintohtml5.info/semantics.html http://diveinto.html5doctor.com/

I will explain in part
HTML5 was written with this type of document such as
<!DOCTYPE html>

While HTML 4
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

We can see a way to open our website by pressing CTRL + U
view-source:http://community.mybb.com/
http://community.mybb.com/ you can replace with your MyBB

For its part the HTML tags that are usually like this
HTML5
<html lang="en" xml:lang="en">

HTML4
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

read more here http://diveintohtml5.info/semantics.html http://diveinto.html5doctor.com/

Points of Tutorial

Open ./inc/functions.php
Find
$contents = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n".$contents; 

Replace
$contents = "<!DOCTYPE html>\n".$contents; 

Then
Find
$contents = str_replace("<html", "<html xmlns=\"http://www.w3.org/1999/xhtml\"", $contents); 

Replace
$contents = str_replace("<html", "<html", $contents); 

For
xmlns="http://www.w3.org/1999/xhtml"
it is not necessary in HTML5

Open
ACP > Templates & Style > Templates > Templates (using) > Ungrouped Templates > htmldoctype

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Replace
<!DOCTYPE html>

It can use or not is all up to you, This is the element type javascript

replace all
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/name_javascript.js"></script>

be
<script src="{$mybb->settings['bburl']}/jscripts/name_javascript.js"></script>

change
<meta http-equiv="Content-Type" content="text/html; charset={$charset}" />

be
<meta charset="{$charset}">

if you are going to make a pretty write javascript like this
<script> ... </script>
if you are going to make a pretty write CSS like this
<style> ... </style>

please if there is an error please to be justified Big Grin
sorry if my english is not good Wink
Just curious, would this cause any issues with plugins, theme, templates, and the forum overall?

I know some themes are in HTML5 so I'm guessing not but who knows. Toungue
Thanks
(2014-01-24, 08:52 PM)SunDi3yansyah Wrote: [ -> ]...http://diveintohtml5.info/semantics.html ...

"..the HTML5 doctype, which is shorter and sweeter and also triggers “standards mode” in all modern browsers. "

Smile
Moreover, tomorrow will come MyBB version 1.8 and 2.0
more privileged
AWESOME Big Grin
I don't get any validation errors using HTML5, without the core edit.
Whats the point if it validates?

Making updating harder?

Thanks anyway for this guide, a plugin would be even better.
but in this section
xmlns="http://www.w3.org/1999/xhtml"
it was not required in HTML5
and it must change in core files

Okey Big Grin thanks Big Grin