OpenCart 将变量从控制器传递给树枝
嗨!
我需要使用 twig 文件中的一些数据,我如何将它从 header.php 传递到 twig 文件?我在 $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.
相关文章