Would this technically pass as a basic level template system in php?
So there are two files, index.php and Template_Module.php
Here is index.php code
<?php
include("Template_Module.php");
$set_name = "My Website";
$set_desc = "My Website for random bla bla";
$set_key = "site, random, bla, for";
echo template_header_object($set_name, $set_desc, $set_key);
and here is Template_Module.php code
<?php
function template_header_object($set_title, $set_desc, $set_keywords) {
$title_object = htmlspecialchars($set_title); //lets get html title to pass
$desc_object = htmlspecialchars($set_desc); //lets get meta description to pass
$keyw_object = htmlspecialchars($set_keywords); //lets get meta keywords to pass
$template_create_object .= <<<OBJECT
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>$title_object</title>
<!-- general meta -->
<meta name="description" content="$desc_object">
<meta name="keywords" content="$keyw_object">
<!-- mobile specific meta -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!-- open graph meta -->
<meta property="og:title" content="$title_object">
<meta property="og:image" content="/assets/img/logo_fbtype.png">
<meta property="og:site_name" content="$title_object">
<meta property="og:description" content="$desc_object">
<!-- style sheets and scripts -->
<link href="/assets/css/style.css" rel="stylesheet">
<link href="/assets/css/reset.css" rel="stylesheet">
<link href="/assets/img/favicon.png" rel="shortcut icon">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body></body></html>
OBJECT;
return $template_create_object;
}
And is there a way I can improve the way html is rendered to browser, so the source code looks nicer instead of being completely off from how it looks at $template_create_object .= <<<OBJECT
and is there a better way for passing values from index.php to template_object.php
Yes, it's a perfectly good way of doing a basic template in PHP. It's very basic, and doesn't offer much flexibility, but it's a quick and easy starting point. If you don't need anything more complex, it'll suit you fine. (If you do need something more complex, there are plenty of open source PHP templating packages you can use)
Seriously, don't worry about how the finished HTML code looks. You shouldn't need to look at it anyway (If you need to debug it, use the browser's DOM view; it's a much easier way to work with it than viewing the source, even if the source if neat and tidy).