From f7ddc264d832d163494904da67ca96856335487b Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sat, 24 May 2014 01:54:04 +0200 Subject: Simple autoloader for examples and tests. --- example/index.php | 9 +++++---- steloader.php | 16 ++++++++++++++++ tests/test.php | 12 +++++++----- 3 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 steloader.php diff --git a/example/index.php b/example/index.php index b8a6938..a0aa03c 100644 --- a/example/index.php +++ b/example/index.php @@ -2,11 +2,12 @@ # Example program to demonstrate the STE... -require_once(dirname(__FILE__) . "/../ste.php"); +require_once(dirname(__FILE__) . "/../steloader.php"); +use \kch42\ste; # Initialize an STECore instance -$ste = new \ste\STECore( - new \ste\FilesystemStorageAccess( # The STECore needs a StorageAccess implementation, we are using the FilesystemStorageAccess, which comes with STE. +$ste = new ste\STECore( + new ste\FilesystemStorageAccess( # The STECore needs a StorageAccess implementation, we are using the FilesystemStorageAccess, which comes with STE. dirname(__FILE__) . "/templates/src", # FilesystemStorageAccess needs a directory, where the Templates are... dirname(__FILE__) . "/templates/transc" # ...and a directory for the transcompiled templates (write permissions needed). ) @@ -32,7 +33,7 @@ $ste->register_tag("repeat", { $output = ""; if(!is_numeric($params["n"])) - throw new \ste\RuntimeError("Sorry, but parameter n must be a number..."); + throw new ste\RuntimeError("Sorry, but parameter n must be a number..."); for($i = 0; $i < $params["n"]; ++$i) $output .= $sub($ste); diff --git a/steloader.php b/steloader.php new file mode 100644 index 0000000..166f52d --- /dev/null +++ b/steloader.php @@ -0,0 +1,16 @@ +mute_runtime_errors = false; test_func($ste); echo $ste->exectemplate("test.tpl"); -- cgit v1.2.3-54-g00ecf