Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add {continue} support for loops.
{continue} command can now be used in loops as statedi in documentation.
  • Loading branch information
ovunctukenmez committed May 6, 2017
commit 7019eda0c035393760eea4540ef84d9724a34b2d
9 changes: 9 additions & 0 deletions inc/rain.tpl.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ protected function compileTemplate( $template_code, $tpl_basedir ){
//tag list
$tag_regexp = array( 'loop' => '(\{loop(?: name){0,1}="\${0,1}[^"]*"\})',
'break' => '(\{break\})',
'continue' => '(\{continue\})',
'loop_close' => '(\{\/loop\})',
'if' => '(\{if(?: condition){0,1}="[^"]*"\})',
'elseif' => '(\{elseif(?: condition){0,1}="[^"]*"\})',
Expand Down Expand Up @@ -497,6 +498,14 @@ protected function compileCode( $parsed_code ){
$compiled_code .= '<?php break; ?>';

}

// loop continue
elseif( strpos( $html, '{continue}' ) !== FALSE ) {

//else code
$compiled_code .= '<?php continue; ?>';

}

//close loop tag
elseif( strpos( $html, '{/loop}' ) !== FALSE ) {
Expand Down