smarty では、このような html コードに遭遇します。**
{section name=listAll loop=$scope}
(input id="a1" name="from" / >
(input id="b1" name="from" / >
(input id="c1" name="from" / >
{/section}
{section name=listAll loop=$scope}
(input id="a2" name="from" / >
(input id="b2" name="from" / >
(input id="c2" name="from" / >
{/section}
{section name=listAll loop=$scope}
(input id="a3" name="from" / >
(input id="b3" name="from" / >
(input id="c3" name="from" / >
{/section}
次のような関数に転送できますか:
function RenderControl($i)
{
return '
{section name=listAll loop=$scope}
(input id="a$i" name="from" / >
(input id="b$i" name="from" / >
(input id="c$i" name="from" / >
{/section}
} ';
次に、次のように tpl ファイルで呼び出します。
{RenderControl i=1}
{RenderControl i=2}
{RenderControl i=3}
以下が smarty tpl で機能しないのはなぜですか?$smarty->register_function('RenderHtml','RenderHtml'); function RenderHtml($params){ extract($params); // $html= ' {include file="tke-pre_bid_scopeworkModules/Section1_Factory_to_Price_Optional_Configurat ion.tpl"} ' ; $html を返します。}
{RenderHtml num=12}