OpenCart将变量从控制器传递到树枝 [英] OpenCart pass variable to twig from controller
本文介绍了OpenCart将变量从控制器传递到树枝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!
我需要在树枝文件中使用一些数据,如何将其从header.php传递到树枝文件?我在$ data数组中创建了一个新元素,但是在树枝文件中不存在.
I need to use some data in twig files, how do I pass it from header.php to twig files? I created a new element in $data array, but It doesn't exist in the twig files.
$data['testvar'] = "test string";
我尝试像这样在树枝文件中访问它:
And I try to access it in twig files like this:
{{ testvar }}
推荐答案
进行了一些更改后,您必须在管理控制台中刷新您的修改并清除缓存,并清除右上角的蓝色齿轮图标.
After you made some changes, you must in admin dashboard refresh your modifications and clear cache, blue gear icon in right upper corner.
这篇关于OpenCart将变量从控制器传递到树枝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文