Tutorials

Figaro => Templates.html

A Screenshot of Figaro

Using Figaro Templates

In order to use Figaro's page rendering engine you must create three files:

Setting up the Root level page

  1. Create a new page in your root directory called "hello.php"
  2. Open the file and add the following code: $Page = new Page('figaro/pages/_template.htm'); //this tells Figaro what template file to use for this page.
  3. Add: $Page->defineElement($thisPage, 'figaro/pages/hello.content.htm'); //this tells figaro where the main content of the page is coming from. $thisPage is just a placeholder - it can be any name.
  4. Add: $hello = 'hello'; //this sets the variable $hello to the string hello.
  5. Add: $Page->$thisPage->addContent('RIGHTCONTENT', $hello); //this sends the variable hello to the RIGHTCONTENT pointer in your content file.
  6. Add: $Page->render(); //this invokes Figaro's page renderer.

Setting up the Template file

  1. Create a file called "_template.htm"
  2. Insert the standard Doctype and basic html shell stuff in this page
  3. Somewhere inbetween your body tags insert a place holder (this will be replaced by the Content file you're about to setup)
  4. This is the place to put any persitent content (navigation, copyright verbage, contentWrapper div)

Setting up the Content file

  1. Create a file called "hello.content.htm"
  2. Put the placeholder anywhere in the page. Pointers like this recieve dynamic content from your Root level page.
  3. Insert anything that you want to be included in this specific page.