save Tpex commit
This commit is contained in:
@@ -152,7 +152,10 @@ class Parser implements ParserInterface
|
||||
|
||||
$tpex->init($this->container->get("request"), $this->container->get("dispatcher"), $content, THELIA_TEMPLATE_DIR . rtrim($this->template, "/") . "/");
|
||||
$tpex->configure(
|
||||
array("foo" => "Test\Loop\Foo"),
|
||||
array(
|
||||
"foo" => "Test\Loop\Foo",
|
||||
"doobitch" => "Test\Loop\Doobitch"
|
||||
),
|
||||
array(),
|
||||
array(
|
||||
"secure" => "Thelia\Core\Template\BaseParam\Secure"
|
||||
|
||||
Submodule core/lib/Thelia/Tpex updated: 35d0fa177d...3558c816e2
39
local/plugins/Test/Loop/Doobitch.php
Normal file
39
local/plugins/Test/Loop/Doobitch.php
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -5,33 +5,22 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<div>TODO write content #SET{toto, 4} toto vaut #GET{toto} zeafazefaze azef azef azef azef
|
||||
<div>TODO write content #SET{toto, 4} toto vaut #GET{toto} zeafazefaze azef azef azef azef <br />
|
||||
<THELIA_FOO type="foo" id="loop1" param1="#GET{toto}">
|
||||
#TOTO
|
||||
<THELIA_FU type="doobitch" param1="value1" param2="#TUTU">
|
||||
#ALFRED azd azd azed azd
|
||||
<T:CHAPO>#CHAPO</T:CHAPO>le chapo est vide<//T:CHAPO>
|
||||
toto : #TOTO <br />
|
||||
count : #__COUNT__ <br /><br />
|
||||
<THELIA_FU type="doobitch" param1="#__COUNT__" param2="#TUTU">
|
||||
#ALFRED azd azd azed azd <br />
|
||||
<T:CHAPO>#CHAPO n'est pas vide</T:CHAPO>le chapo est vide<//T:CHAPO> <br />
|
||||
</THELIA_FU>
|
||||
</THELIA_FOO>
|
||||
<T_BAR>
|
||||
avant boucle
|
||||
<THELIA_BAR type="bar" id="loop2" param1="value1">
|
||||
#FU
|
||||
<TEST_ex3 variable="#UNEVARIABLE" test="egal" valeur="0">
|
||||
UNEVARIABLE vaut zéro
|
||||
</TEST_ex3>
|
||||
UNEVARIABLE ne vaut pas zéro
|
||||
<//TEST_ex3>
|
||||
</THELIA_BAR>
|
||||
après boucle
|
||||
</T_BAR>
|
||||
après boucle vide
|
||||
<//T_BAR>
|
||||
|
||||
|
||||
<REM>
|
||||
<REPEAT_loopy start="1" end="5" increment="2">
|
||||
Compteur = #INDEX<br />
|
||||
</REPEAT_loopy>
|
||||
|
||||
</REM>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user