genpasta...

...is a tiny command-line tool for web developers that helps building static web pages with PHP.

How does it work?

Suppose you have a directory tree like this:

sourcedir/
  root.tmpl.html
  subdir1/
    subdir1.tmpl.html
    subdir2/
      subdir2.tmpl.html
      foobar.html
          

The contents of the files being:

root.tmpl.html

<html>
  <head>
    <title>
      Foo
    </title>
  </head>
  <body>
    @@contents;
  </body>
</html>
            

subdir1.tmpl.html

<div>
  <h1>Contents:</h1>
  @@contents;
</div>
            

subdir2.tmpl.html

<p>
  @@contents;
</p>
            

foobar.html

<b>Hello</b> world!
            

Now suppose we run genpasta on this source tree, like this:

genpasta sourcedir targetdir

We get the following result in targetdir:

sourcedir/
  subdir1/
    subdir2/
      foobar.html
          

And we get this file:

foobar.html

<html>
  <head>
    <title>
      Foo
    </title>
  </head>
  <body>
    <div>
      <h1>Contents:</h1>
      <p>
        <b>Hello</b> world!
      </p>
    </div>
  </body>
</html>
            

Details

These two types of files can contain any PHP code (by you!), that will be executed by genpasta when generating the result HTML files.

Other files are simply copied to the destination directory.

Interested?

genpasta is written entirely in PHP. It has been tested under GNU/Linux so far.

If you're interested, check its SourceForge page to download it!

Remember, this is interesting for small static web sites only with zero dynamic content. For anything more complicated, you could check something like Ruby On Rails for example (or a similar modern framework).

Contact: rolf1 at free dot fr

Thanks to SourceForge for hosting this project:
SourceForge.net Logo