开发者

How do I fetch a variable by the value of another variable in HTML::Template::Pro?

<TMPL_LOOP NAME="loopname">
    <TMPL_VAR NAME="<TMPL VAR NAME="anothervariable">">
</TMPL_LOOP>

What I want to to is pretty much like this:

$a= 1;
$b = 'a';
print $$b;

As you see ,I need to refer to the variable whose name is contained in another variable,

bu开发者_Go百科t the above doesn't work..

Is there a way to work around?


There's no way to do that AFAIK.


Same answer as here: http://www.perlmonks.org/?node_id=918281 : Proprocess the data you send to your template system, and put it into a form that it can understand (ie fixed hash key).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜