From b2281f4c774575ec4f5127551177ef3389b7ea5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Passerieu?= Date: Tue, 20 Mar 2018 16:44:04 +0100 Subject: [PATCH] fix #2 and directly trim on the global regex --- test-TplBlock/sample.txt | 15 ------------- test-TplBlock/test.php | 47 ---------------------------------------- 2 files changed, 62 deletions(-) delete mode 100644 test-TplBlock/sample.txt delete mode 100644 test-TplBlock/test.php diff --git a/test-TplBlock/sample.txt b/test-TplBlock/sample.txt deleted file mode 100644 index a6346a1..0000000 --- a/test-TplBlock/sample.txt +++ /dev/null @@ -1,15 +0,0 @@ -hello {{title}} {{name}} {{firstname}} - -The first primes numbers are: - - - {{primes.number}} - - -Lets list all divisors of: - - -{{number.value}} Have those divisors: - - - {{number.divisor.value}} - - \ No newline at end of file diff --git a/test-TplBlock/test.php b/test-TplBlock/test.php deleted file mode 100644 index 5ed5be2..0000000 --- a/test-TplBlock/test.php +++ /dev/null @@ -1,47 +0,0 @@ -add_vars(array( - "name" => "Gnieark", - "title" => "Monsieur", - "firstname" => "Grouik" - ) - ); - -$primes = array(1,2,3,5,7,11); - -// a sub bloc -foreach($primes as $prime){ - $tplPrime = new TplBlock('primes'); - $tplPrime->add_vars(array('number' => $prime)); - $tpl->add_sub_block($tplPrime); -} - -// test sub - sub blocs -for ($i = 2; $i < 121; $i++){ - - $tplNumber = new TplBlock('number'); - $tplNumber->add_vars( array("value" => $i)); - $index = 1; - $number = $i; - while ( $number > 1 && $index < count($primes)){ - if($number % $primes[$index] == 0){ - $number = $number / $primes[$index]; - $tplDivisor = new TplBlock("divisor"); - $tplDivisor->add_vars( array("value" => $primes[$index])); - $tplNumber->add_sub_block($tplDivisor); - }else{ - $index++; - } - } - $tpl->add_sub_block($tplNumber); -} - - - -echo $tpl->apply_tpl_file("sample.txt",false); \ No newline at end of file