save Tpex commit

This commit is contained in:
Manuel Raynaud
2013-03-15 12:33:20 +01:00
parent b982c6d6c4
commit 8aaac2c5a2
4 changed files with 55 additions and 24 deletions

View File

@@ -0,0 +1,39 @@
<?php
/**
* Created by JetBrains PhpStorm.
* User: manu
* Date: 15/03/13
* Time: 09:23
* To change this template use File | Settings | File Templates.
*/
namespace Test\Loop;
use Thelia\Tpex\Element\Loop\BaseLoop;
use Thelia\Tpex\Tools;
class Doobitch extends BaseLoop {
public function exec($text, $args)
{
$param1 = Tools::extractValueParam("param1", $args);
$res = "";
if($param1 == 2 || $param1 == 3) {
for($i = 0; $i < 4; $i++) {
$tmp = str_replace("#ALFRED", "foo".$i, $text);
if($i%2){
$tmp = str_replace("#CHAPO", "bar".$i, $tmp);
} else {
$tmp = str_replace("#CHAPO", "", $tmp);
}
$res .= $tmp;
}
}
return $res;
}
}