Php Smarty模板无法从自定义配置文件获取值
我已经构建了一个名为logo.tpl的定制smarty tpl文件。 现在,我想修改logo.tpl(ojs/templates/common)文件,如下所示:Php Smarty模板无法从自定义配置文件获取值,php,configuration,smarty,Php,Configuration,Smarty,我已经构建了一个名为logo.tpl的定制smarty tpl文件。 现在,我想修改logo.tpl(ojs/templates/common)文件,如下所示: {config_load file='foo.conf'} <div class="logo"> <img alt="logo" height="73" width="75" src="{$baseUrl}/images/logo.jpg"/> </div> <div class="slogan
{config_load file='foo.conf'}
<div class="logo">
<img alt="logo" height="73" width="75" src="{$baseUrl}/images/logo.jpg"/>
</div>
<div class="slogan">
{$smarty.config.siteDesc}
</div>
我可以从页面源中看到的输出是:
<div class="logo">
<img alt="logo" height="73" width="75"
src="http://localhost/ojs-2.3.7/images/logo.jpg"/>
</div>
<div class="slogan">
</div>
因此,尽管我将foo.conf放在ojs/templates/common文件夹中,即与logo.tpl相同的文件夹中,但这些值并没有得到反映
因此,在这方面的任何帮助都将不胜感激
注:关于OJS的详细信息:
EDIT:这可以通过使用{config\u load file=“core:common/foo.conf”}并将foo.conf放置到lib\pkp\templates\common路径来解决。谢谢tpaksu。这可以通过使用
{config_load file="core:common/foo.conf"}
<div class="logo">
<img alt="logo" height="73" width="75" src="{$baseUrl}/images/logo.jpg"/>
</div>
<div class="slogan">
{$smarty.config.siteDesc}
</div>
{config_load file=“core:common/foo.conf”}
{$smarty.config.siteDesc}
并将foo.conf放置到lib\pkp\templates\common路径。谢谢tpaksu。可能是路径问题?文件路径是否相对于templates目录?@tpaksu正如我所提到的,我将两者放在同一个目录中。好的,但我仍然很好奇,您是否尝试加载“common/foo.conf”?@tpaksu我尝试过并遇到相同的问题:(
{config_load file="core:common/foo.conf"}
<div class="logo">
<img alt="logo" height="73" width="75" src="{$baseUrl}/images/logo.jpg"/>
</div>
<div class="slogan">
{$smarty.config.siteDesc}
</div>