PHP Classes

File: plugin/for.php

Recommend this page to a friend!
  Classes of bassam alessawi  >  Sfhati PHP engine  >  plugin/for.php  >  Download  
File: plugin/for.php
Role: Auxiliary script
Content type: text/plain
Description: Class source
Class: Sfhati PHP engine
Template engine that generates PHP compiled files
Author: By
Last change:
Date: 7 years ago
Size: 737 bytes
 

Contents

Class file image Download
<?php
/*
  use like [for:"id for this loop","start counter","count to","content loop"end for]
  [for:"lop","4","10","this is %lop% , so can use as a var like %lop-var% "end for]
  //result
 <?php for($lop=4;$lop<10;$lop++){ ?>
    this is <?php echo "$lop"; ?> , so can use as a var like $lop
 <?php }?>

 */
function for_SYNTAX($vars) {
    global
$syntaxcode;
    foreach (
$vars as $v => $var) {
       
$vars[$v] = $syntaxcode->Syntax($var);
    }
   
$vars[3] = str_replace('%' . $vars[0] . '%', "<?php echo \"\$$vars[0]\"; ?>", $vars[3]);
   
$vars[3] = str_replace('%' . $vars[0] . '-var%', "\$$vars[0]", $vars[3]);


    return
"
<?php for(\$
$vars[0]=$vars[1];\$$vars[0]<$vars[2];\$$vars[0]++){ ?>
$vars[3]
<?php }?>
"
;
}

For more information send a message to info at phpclasses dot org.