From d0b7317e10254490acbe748d1d8c1e04aaf8be6b Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Wed, 27 Jun 2012 21:09:07 +0200 Subject: Added new Tags to the standard library. * ste:in_array checks, if a value is in an array * ste:join joins an array with a glue string * ste:split splits a string with a delimiter to an array * ste:array_add adds an element to an array. --- example/templates/transc/articles.html.php | 172 +++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 example/templates/transc/articles.html.php (limited to 'example/templates/transc/articles.html.php') diff --git a/example/templates/transc/articles.html.php b/example/templates/transc/articles.html.php new file mode 100644 index 0000000..d52658c --- /dev/null +++ b/example/templates/transc/articles.html.php @@ -0,0 +1,172 @@ +load("custom_tags.tpl"); + $outputstack[$outputstack_i] .= $ste->load("master.html"); + $blockname_4feb57c8eb53c0_39108239 = "content"; + $ste->blocks['4feb57c8eb54f8.57715029'] = array_pop($outputstack); + $ste->blockorder[] = '4feb57c8eb54f8.57715029'; + $outputstack = array(''); + $outputstack_i = 0; + $outputstack[$outputstack_i] .= "

Some Articles

\n\t"; + $parameters_4feb57c8eb55d1_49937129 = array(); + $parameters_4feb57c8eb55d1_49937129['array'] = "articles"; + $parameters_4feb57c8eb55d1_49937129['value'] = "article"; + $parameters_4feb57c8eb55d1_49937129['max'] = "3"; + $parameters_4feb57c8eb55d1_49937129['counter'] = "i"; + $outputstack[$outputstack_i] .= $ste->call_tag('foreach_limit', $parameters_4feb57c8eb55d1_49937129, function($ste) + { + $outputstack = array(''); + $outputstack_i = 0; + $outputstack[$outputstack_i] .= "

"; + $parameters_4feb57c8eb59c3_59434363 = array(); + $outputstack[$outputstack_i] .= $ste->call_tag('uppercase', $parameters_4feb57c8eb59c3_59434363, function($ste) + { + $outputstack = array(''); + $outputstack_i = 0; + $parameters_4feb57c8eb5a98_71645476 = array(); + $outputstack[$outputstack_i] .= $ste->call_tag('escape', $parameters_4feb57c8eb5a98_71645476, function($ste) + { + $outputstack = array(''); + $outputstack_i = 0; + $outputstack[$outputstack_i] .= @$ste->vars["article"]["title"]; + return array_pop($outputstack); + }); + return array_pop($outputstack); + }); + $outputstack[$outputstack_i] .= "

\n\t\t
Author: "; + $parameters_4feb57c8eb5f92_71020272 = array(); + $outputstack[$outputstack_i] .= $ste->call_tag('escape', $parameters_4feb57c8eb5f92_71020272, function($ste) + { + $outputstack = array(''); + $outputstack_i = 0; + $outputstack[$outputstack_i] .= @$ste->vars["article"]["author"]; + return array_pop($outputstack); + }); + $outputstack[$outputstack_i] .= "
\n\t\t
"; + $parameters_4feb57c8eb62b8_11002450 = array(); + $parameters_4feb57c8eb62b8_11002450['timestamp'] = @$ste->vars["article"]["timestamp"]; + $outputstack[$outputstack_i] .= $ste->call_tag('date', $parameters_4feb57c8eb62b8_11002450, function($ste) + { + $outputstack = array(''); + $outputstack_i = 0; + $outputstack[$outputstack_i] .= "%d. %h. %Y, %H:%M:%S"; + return array_pop($outputstack); + }); + $outputstack[$outputstack_i] .= "
\n\t\t
\n\t\t\t"; + $outputstack[] = ""; + $outputstack_i++; + $outputstack[$outputstack_i] .= (($ste->get_var_by_name("i")) == ("0")) ? 'yes' : ''; + $outputstack_i--; + if($ste->evalbool(array_pop($outputstack))) + { + $outputstack[$outputstack_i] .= "\n\t\t\t\t\t" . @$ste->vars["article"]["full"]; + + } + else + { + $outputstack[$outputstack_i] .= "\n\t\t\t\t\t" . @$ste->vars["article"]["excerpt"]; + + } + $outputstack[$outputstack_i] .= "
\n\t\t
\n\t"; + return array_pop($outputstack); + }); + $outputstack[] = ''; + $outputstack_i++; + $parameters_4feb57c8eb72f3_12728934 = array(); + $parameters_4feb57c8eb72f3_12728934['array'] = "articles"; + $outputstack[$outputstack_i] .= $ste->call_tag('arraylen', $parameters_4feb57c8eb72f3_12728934, function($ste) { return ''; }); + $outputstack_i--; + $ste->set_var_by_name("articles_n", array_pop($outputstack)); + $outputstack[] = ""; + $outputstack_i++; + $outputstack[$outputstack_i] .= ((@$ste->vars["articles_n"]) > ("3")) ? 'yes' : ''; + $outputstack_i--; + if($ste->evalbool(array_pop($outputstack))) + { + $outputstack[$outputstack_i] .= "

There are more articles.

\n\t\t"; + + } + $outputstack[$outputstack_i] .= "

Some more useless demo stuff...

\n\t\t

Counting from 10 to 0...

\n\t\t

but take only the even ones and multiply by 5...

\n\t\t"; + $forloop_4feb57c8eb7965_88913250_start = "10"; + $forloop_4feb57c8eb7965_88913250_stop = "0"; + $forloop_4feb57c8eb7965_88913250_countername = "i"; + for($forloop_4feb57c8eb7965_88913250_counter = $forloop_4feb57c8eb7965_88913250_start; $forloop_4feb57c8eb7965_88913250_counter >= $forloop_4feb57c8eb7965_88913250_stop; $forloop_4feb57c8eb7965_88913250_counter += -1) + { + try + { + $ste->set_var_by_name($forloop_4feb57c8eb7965_88913250_countername, $forloop_4feb57c8eb7965_88913250_counter); + $outputstack[] = ""; + $outputstack_i++; + $outputstack[] = ''; + $outputstack_i++; + $outputstack[$outputstack_i] .= @$ste->vars["i"]; + $outputstack_i--; + $tmp_even = array_pop($outputstack); + $outputstack[$outputstack_i] .= (is_numeric($tmp_even) and ($tmp_even % 2 == 0)) ? 'yes' : ''; + $outputstack_i--; + if($ste->evalbool(array_pop($outputstack))) + { + $outputstack[] = ''; + $outputstack_i++; + $outputstack[$outputstack_i] .= @$ste->vars["i"] . " * 5"; + $outputstack_i--; + $outputstack[$outputstack_i] .= $ste->calc(array_pop($outputstack)); + $outputstack[$outputstack_i] .= "
\n\t\t\t\t"; + + } + + } + catch(\ste\BreakException $e) { break; } + catch(\ste\ContinueException $e) { continue; } + + } + + $outputstack[$outputstack_i] .= "

Repeat some text...

\n\t\t"; + $parameters_4feb57c8eb86f4_27000372 = array(); + $parameters_4feb57c8eb86f4_27000372['n'] = "10"; + $outputstack[$outputstack_i] .= $ste->call_tag('repeat', $parameters_4feb57c8eb86f4_27000372, function($ste) + { + $outputstack = array(''); + $outputstack_i = 0; + $outputstack[$outputstack_i] .= "

Bla

\n\t\t"; + return array_pop($outputstack); + }); + $outputstack[$outputstack_i] .= "

Get a variable's content dynamically

\n\t\t"; + $outputstack[$outputstack_i] .= $ste->get_var_by_name(@$ste->vars["foo"] . "[" . @$ste->vars["bar"] . "]");$outputstack[$outputstack_i] .= "

We will call ste:repeat with a non-numerical value for n here to see the handling of a RuntimeError

\n\t\t"; + $parameters_4feb57c8eb8be8_11772552 = array(); + $parameters_4feb57c8eb8be8_11772552['n'] = "lol"; + $outputstack[$outputstack_i] .= $ste->call_tag('repeat', $parameters_4feb57c8eb8be8_11772552, function($ste) + { + $outputstack = array(''); + $outputstack_i = 0; + $outputstack[$outputstack_i] .= "

Bla

\n\t\t"; + return array_pop($outputstack); + }); + $parameters_4feb57c8eb8e64_48510077 = array(); + $parameters_4feb57c8eb8e64_48510077['array'] = "hai"; + $parameters_4feb57c8eb8e64_48510077['delim'] = ","; + $outputstack[$outputstack_i] .= $ste->call_tag('split', $parameters_4feb57c8eb8e64_48510077, function($ste) + { + $outputstack = array(''); + $outputstack_i = 0; + $outputstack[$outputstack_i] .= "a,b,c,d,e"; + return array_pop($outputstack); + }); + $parameters_4feb57c8eb91f2_76021324 = array(); + $parameters_4feb57c8eb91f2_76021324['array'] = "hai"; + $outputstack[$outputstack_i] .= $ste->call_tag('join', $parameters_4feb57c8eb91f2_76021324, function($ste) + { + $outputstack = array(''); + $outputstack_i = 0; + $outputstack[$outputstack_i] .= "
"; + return array_pop($outputstack); + }); + $ste->blocks[$blockname_4feb57c8eb53c0_39108239] = array_pop($outputstack); + if(array_search($blockname_4feb57c8eb53c0_39108239, $ste->blockorder) === FALSE) + $ste->blockorder[] = $blockname_4feb57c8eb53c0_39108239; + $outputstack = array(''); + $outputstack_i = 0; + return array_pop($outputstack); +}; ?> \ No newline at end of file -- cgit v1.2.3-70-g09d2