简体   繁体   中英

Smarty localization label - how to use in php?

Im using smarty localization to get language labels

{config_load file="localization.conf" section=$project->lang}

When I need some label from localization.conf I will put into smarty template file (tpl) ex. {#label#} (where label in localization.conf = 'some text' )

But now I need to use label in php file , How to do that ?

If you want to use config variables before output (assume html output) you can load config in php

$smarty->configLoad('test.conf', 'Login');

var_dump($smarty->getConfigVars());   

$smarty->display('test.tpl');

Those config data loaded via PHP will be also visible in Smarty templates. More info: http://www.smarty.net/docs/en/api.get.config.vars.tpl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM