aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template_executor_include.php
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-05-03 23:53:22 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2011-05-04 01:21:44 -0400
commitd06e59f63bc8213a4d679ff0c20a23dcf8cd524e (patch)
tree7c80b3768be92135840a8095bca0d0a3f6ed263b /phpBB/includes/template_executor_include.php
parent237deb12cea909822e0f2fa3c072d31adfec3fb1 (diff)
downloadforums-d06e59f63bc8213a4d679ff0c20a23dcf8cd524e.tar
forums-d06e59f63bc8213a4d679ff0c20a23dcf8cd524e.tar.gz
forums-d06e59f63bc8213a4d679ff0c20a23dcf8cd524e.tar.bz2
forums-d06e59f63bc8213a4d679ff0c20a23dcf8cd524e.tar.xz
forums-d06e59f63bc8213a4d679ff0c20a23dcf8cd524e.zip
[feature/template-engine] Split template execution logic into classes.
Template executor interface defines a template executor object. It is an object which can execute (i.e. display/render) a template. Currently there are two implementations: * phpbb_template_executor_include includes php code from a file. * phpbb_template_executor_eval eval's php code. PHPBB3-9726
Diffstat (limited to 'phpBB/includes/template_executor_include.php')
-rw-r--r--phpBB/includes/template_executor_include.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/phpBB/includes/template_executor_include.php b/phpBB/includes/template_executor_include.php
new file mode 100644
index 0000000000..74f0593b13
--- /dev/null
+++ b/phpBB/includes/template_executor_include.php
@@ -0,0 +1,32 @@
+<?php
+
+/**
+* Template executor that stores path to php file with template code
+* and evaluates it by including the file.
+*/
+class phpbb_template_executor_include implements phpbb_template_executor
+{
+ /**
+ * Template path to be included.
+ */
+ private $path;
+
+ /**
+ * Constructor. Stores path to the template for future inclusion.
+ *
+ * @param string $path path to the template
+ */
+ public function __construct($path)
+ {
+ $this->path = $path;
+ }
+
+ /**
+ * Executes the template managed by this executor by including
+ * the php file containing the template.
+ */
+ public function execute()
+ {
+ include($this->path);
+ }
+}