Our current site is broken down into various easy to work with PHP includes that are brought together using one of those nifty PHP templating libraries.
We currently use an Ant build to optimize most of our front-end code in regards to concatenating, minifying and image optimization. What we would like to do is add an additional Ant task that will parse the PHP template files and output static HTML pages into our build folder.
Could anyone point me in the right direction?
A very basic example below of what I would like to achieve:
PHP template before build
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/tpl/basic-template.php');
startblock('title');
echo 'Test page';
endblock();
startblock('content');
include($_SERVER['DOCUMENT_ROOT'].'/incl/content-fragment.php');
endblock();
?>
Is it possible through an Ant task to create the static HTML page of the above as so:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test page</title>
</head>
<body>
<p>This paragraph was the contents of content-fragment.php</p>
</body>
</html>
You could use the Ant Get task by hosting files in a build server that is running apache: