简体   繁体   English

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

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

I'm trying to get smarty value in my profile_account.tpl file. 我正在尝试在我的profile_account.tpl文件中获得明智的价值。

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

How can I get this in top_quick_links.tpl ? 如何在top_quick_links.tpl获得此top_quick_links.tpl

"$smarty.capture.profile_pic"

But that doesn't return any value. 但这不会返回任何值。 How can I do it? 我该怎么做?

Maybe you did not assign the $user_data array for the template engine. 也许您没有为模板引擎分配$user_data数组。 Your solution is not so elegant. 您的解决方案不是那么优雅。 I suggest you to put this into your controller file: 我建议您将其放入控制器文件中:

This is the way to assign custom variable for Smarty in CS-Cart 这是在CS-Cart中为Smarty分配自定义变量的方法

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

And use this variable directly in the .tpl file: 并直接在.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