I’m new to PHP, and I’m looking to do what I’d normally do with Struts Tiles in JSP. I’m looking for something like:
Template.php:
<html><body>
<div class="header"></div>
<div class="contents">
<#insert sectionName="pageContents">
</div>
</body></html>
Content.php:
<#template name="Template.php">
<#section name="pageContents">
<div>
<?php doSomething(); ?>
</div>
</#section>
</#template>
Such that a request for Content.php returns the contents of Content.php included into Template.php appropriately. I’m looking for the fastest solution in terms of minimal installation/configuration time.
You can use any number of php templating systems, but I’d recommend you use php’s native capabilities. There’s no additional performance overhead, and nothing to install or configure.
For instance to mimic the example above, you could do something like:
Template.inc:
Content.php
Of course, there are lots of other ways of accomplishing the example above. That’s another upside to using native capabilities – you can arrange and configure your own templating system to work the way you prefer.