diff options
Diffstat (limited to 'example')
-rw-r--r-- | example/index.php | 5 | ||||
-rw-r--r-- | example/templates/src/articles.html | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/example/index.php b/example/index.php index 14ca576..2ebe3c7 100644 --- a/example/index.php +++ b/example/index.php @@ -12,6 +12,9 @@ $ste = new \ste\STECore( ) ); +# Set STE to a more verbose behavior: +$ste->mute_runtime_errors = False; + # First, lets define some custom tags. # <ste:uppercase> will exchange all letters with their uppercase complement @@ -29,7 +32,7 @@ $ste->register_tag("repeat", { $output = ""; if(!is_numeric($params["n"])) - throw new Exception("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/example/templates/src/articles.html b/example/templates/src/articles.html index 0f20aeb..36f59c4 100644 --- a/example/templates/src/articles.html +++ b/example/templates/src/articles.html @@ -49,4 +49,9 @@ <h3>Get a variable's content dynamically</h3> <ste:get var="${foo}[$bar]" /> + + <h3>We will call ste:repeat with a non-numerical value for n here to see the handling of a RuntimeError</h3> + <ste:repeat n="lol"> + <p>Bla</p> + </ste:repeat> </ste:block> |