Skip to content

Instantly share code, notes, and snippets.

@aurora
Created February 5, 2017 20:02
Show Gist options
  • Save aurora/05f53361db2b1d20303d350169493291 to your computer and use it in GitHub Desktop.
Save aurora/05f53361db2b1d20303d350169493291 to your computer and use it in GitHub Desktop.
----test.php----
<?php
class tpl {
protected $data = array();
public function set($name, $value) {
$this->data[$name] = $value;
}
public function render($name) {
require($name);
}
}
$tpl = new tpl();
$tpl->set('title', 'blubber');
$tpl->render('test.html');
----test.html----
<html>
<head>
<title><?php echo $this->data['title']; ?></title>
</head>
<body>
...
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment