Files
sterivein/local/plugins/Test/Loop/Doobitch.php
Manuel Raynaud 8aaac2c5a2 save Tpex commit
2013-03-15 12:33:20 +01:00

39 lines
835 B
PHP

<?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;
}
}