简体   繁体   English

将 s_categories 表从数据库拉到 shopware 5 中的 someone.tpl

[英]Pulling s_categories table from database to someone.tpl in shopware 5

I want to pull the data from the s_categories table in the database to the tpl file I want and use it as an array, but I couldn't find how to do this in smarty.我想将数据库中s_categories 表中的数据拉到我想要的tpl 文件中,并将其用作数组,但是我在smarty 中找不到如何执行此操作。 (Note: {php}{/php} doesn't work.) (注意:{php}{/php} 不起作用。)

You can't do that in smarty, you need a plugin that provides this data to the template to use it there.你不能在 smarty 中做到这一点,你需要一个插件来提供这个数据给模板以便在那里使用它。 Smarty is a template engine and should not be used for accessing data from the database - this is the wrong layer of the application to do such things. Smarty 是一个模板引擎,不应该用于访问数据库中的数据——这是应用程序的错误层来做这些事情。

All things are covered in the plugin startup guide: https://developers.shopware.com/developers-guide/plugin-quick-start/#search-results插件启动指南中涵盖了所有内容: https://developers.shopware.com/developers-guide/plugin-quick-start/#search-results

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

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