Skip to content
Swaroop SM edited this page Jun 29, 2014 · 1 revision

Quick Example

This is a quick example on using Tower. Firstly, follow the README on installing Tower.

Create 2 files:

  • template.php
  • sample.php

Open template.php and paste the following code:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>
<h2><?= $name ?></h2>
<p><?= $age ?></p>
<code><?= $profession ?></code>
</body>
</html>

Open sample.php and paste the following code:

<?php

require 'vendor/autoload.php';

$tower = new Tower();
$tower->setTemplate('template.php');
$tower->set('name', 'Swaroop SM');
$tower->set('age', 24);
$tower->set('profession', 'Software Developer');
$tower->render();

Open sample.php on your browser and enjoy. 😃

--gg

Clone this wiki locally