我需要从部分更改$ type 。在 from 部分中,我们有一个 PHP 静态函数:
{foreach from=dbPay::getAll(null) item=dbPay}
{foreach from=dbPay::getSomething(null) item=dbPay}
etc.
让我们看看,我们为此创建了一个变量:
{foreach from={$static_php_function} item=dbPay}
用法:
{if ($type == 1)}
// need to assign: dbPay::getAll(null)
// ?? {assign var="static_php_function" value="dbPay::getAll(null)"}
{elseif ($type == 2)}
// need to assign: dbPay::getSomething(null)
// ?? {assign var="static_php_function" value="dbPay::getSomething(null)"}
{/if}
{foreach from={$static_php_function} item=dbPay}
...
{/foreach}