繁体   English   中英

如何在TPL文件中获得聪明的价值-CS购物车?

[英]How to get smarty value in tpl file - cs cart?

我正在尝试在我的profile_account.tpl文件中获得明智的价值。

{capture name="profile_pic"}{$user_data.main_pair.icon.image_path}{/capture}

如何在top_quick_links.tpl获得此top_quick_links.tpl

"$smarty.capture.profile_pic"

但这不会返回任何值。 我该怎么做?

也许您没有为模板引擎分配$user_data数组。 您的解决方案不是那么优雅。 我建议您将其放入控制器文件中:

这是在CS-Cart中为Smarty分配自定义变量的方法

Registry::get("view")->assign("user_profile_picture", $user_data['main_pair']['icon']['image_path']);

并直接在.tpl文件中使用此变量:

<img src="{$user_profile_picture}" />

对于4.x版本,请使用以下代码:

{$smarty.capture.profile_pic nofilter}

暂无
暂无

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

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