What is better...make classes specially for rendering html, sth. like this:
class IndexHTML {
public $doctype = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
public $title = "<title>MICE</title>"; //title of document
public $contentType = "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />";
public $contentStyleType = "<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />";
public $jsSrc = "<script type=\"text/javascript\" src=\"main.js\"></script>"; //your javascript files included
public $css = "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />"; //your css files included
function html_head(){
echo $this->doctype."<html><head>";
echo $this->title,$this->contentType,$this->contentStyleType,$this->jsSrc,$this->css;
echo "</head>";
require_once("classes.php"); //require additional needed scripts
}
}
or is it better to write seperate files like head.html (with only head necessary tags), menu.html, footer.html etc and then write only :
class IndexHTML {
function html_head(){
require_once("head.html");
}
}
I'm new in PHP and try to learn the proper way of dealing with things.
EDIT:Seperate files are better for maintainance. What about performance?
Thank you for advice.