Wallogit.com
2017 © Pedro Peláez
HTML5 Document boilerplate
Outputs an html5 document with a title and a body. UTF-8 encoding is assumed., (*1)
Install it via composer:, (*2)
composer require flsouto/render
Pass the page's title and body as arguments to the render function:, (*3)
Testing the Lib
This is just a test
```
## Using closures
The content doesn't need to be a string. Instead, you can provide a callback that generates the content:
```
<div id="main">
<h1>Example</h1>
<b>Output some markup</b>
</div>
<?php });
Output:, (*4)
<html>
<head>
<title>HTML5 Boilerplate</title>
<meta charset="UTF-8">
</head>
<body>
<div id="main">
<h1>Example</h1>
<b>Output some markup</b>
</div>
</body>
</html>
This is good enough to get you started quickly. However, as your project becomes more complex and you need to further customize the document, let's say, add some extra meta tags or change the document's charset, then you will need something different. What can you do after you have several pages relying on the implementation of the simplistic render function? Here is what you do: you copy the function from the vendor directory to your project's (it's really just one file/function), change the implementation as desired and then remove this package from your composer installation. Done., (*5)