开发者

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

开发者 https://www.devze.com 2023-03-25 18:09 出处:网络
<TMPL_LOOP NAME=\"loopname\"> <TMPL_VAR NAME=\"<TMPL VAR NAME=\"anothervariable\">\">
<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

精彩评论

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