kxc
kxc

Reputation: 1457

Smarty 2 in 1 variable

How can i put in variable 'A', variable 'B'

I have two variable {$current_page} and {$globalContent.INDEX_BTN}

How can i make something like that -> {$globalContent.{$current_page}_BTN} that word INDEX in variable {$globalContent.INDEX_BTN} will switched to value from variable {$current_page}

Edited: I want to do in Smarty, something like this what i can do in PHP

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

P.S variable $lang it's array with many indexes which contain text, and two of them INDEX_BTN & ORDER_BTN, so can i make something like that PHP code in Smarty ? That array lang assigned to Smarty like {$globalContent}

Upvotes: 1

Views: 75

Answers (1)

michail.samolo
michail.samolo

Reputation: 66

{assign var="page_index" value=join('',array($current_page,'_BTN'))}

{$global_content.$page_index}

Upvotes: 1

Related Questions