简体   繁体   English

Smarty本地化标签-如何在PHP中使用?

[英]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. 当我需要localization.conf中的一些标签时,我会将其放到智能模板文件(tpl)中。 {#label#} (where label in localization.conf = 'some text' ) {#label#} (其中localization.conf中的label = 'some text'

But now I need to use label in php file , How to do that ? 但是现在我需要在php文件中使用标签,该怎么做?

If you want to use config variables before output (assume html output) you can load config in php 如果要在输出之前使用config变量(假定为html输出),则可以在php中加载config

$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. 通过PHP加载的那些配置数据也将在Smarty模板中可见。 More info: http://www.smarty.net/docs/en/api.get.config.vars.tpl 更多信息: http : //www.smarty.net/docs/en/api.get.config.vars.tpl

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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