Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Smarty 2合1变量_Php_Variables_Smarty - Fatal编程技术网

Php Smarty 2合1变量

Php Smarty 2合1变量,php,variables,smarty,Php,Variables,Smarty,如何输入变量“A”,变量“B” 我有两个变量{$current\u page}和{$globalContent.INDEX\u BTN} 我怎样才能做出这样的事情->{$globalContent.{$current\u page}{/code>变量{$globalContent.INDEX\u BTN}中的单词索引将从变量{$current\u page}切换为值 编辑: 我想在Smarty中做一些类似于PHP的事情 $lang = array with text $curr_

如何输入变量“A”,变量“B”

我有两个变量
{$current\u page}
{$globalContent.INDEX\u BTN}

我怎样才能做出这样的事情->
{$globalContent.{$current\u page}{/code>变量
{$globalContent.INDEX\u BTN}
中的单词索引将从变量
{$current\u page}切换为值

编辑: 我想在Smarty中做一些类似于PHP的事情

    $lang = array with text
    $curr_page = 'ORDER';
    echo $lang[$curr_page.'_BTN'];

p.S变量
$lang
它的数组包含许多包含文本的索引,其中两个
INDEX\u BTN和ORDER\u BTN
,所以我可以在Smarty中生成类似PHP代码的代码吗?分配给Smarty的数组lang类似于
{$globalContent}

我在这里找不到相关的问题,但我编辑了这篇文章,在PHP中编写了它的外观,我想在Smarty中这样做。这是真的吗?在Smarty中这样想是真的吗?是的,就像我链接的论坛主题一样。我没有这方面的直接经验,因此我不会发布答案,但类似于
{assign var=“btn_var”value=“`$current_page`_btn”}
用作
{$globalContent.$btn_var}
完美,这正是我所需要的,很抱歉无意中阅读了你链接中的主题。谢谢
{assign var="page_index" value=join('',array($current_page,'_BTN'))}

{$global_content.$page_index}