Created
February 5, 2017 20:02
-
-
Save aurora/05f53361db2b1d20303d350169493291 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----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