Ant task to compile PHP file templates into static HTML pages

Our current site is broken down into several easy-to-use PHP libraries that combine using one of these excellent PHP template libraries.

We are currently using the Ant construct to optimize most of our front-end codes for concatenation, image optimization, and image optimization. We would like to add an additional Ant task that will parse PHP template files and output static HTML pages to our build folder.

Can someone point me in the right direction?

The simplest example below is what I would like to achieve:

PHP template before assembly

<?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 to use the Ant task to create a static HTML page above:

<!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>
+5
source share
1

Ant , apache:

<get src="http://buildserver/index.php" dest="app/index.html"/>
+3

All Articles