无法使用视图,如何绕过它并用 php 对其进行编码
我是 drupal 的新手,并且很难获得工作视图(
由于我不知道如何使用视图执行此操作,并且由于在代码中完成此操作通常是一段代码,因此有没有一种方法可以完全绕过视图 UI 界面并使用正常的 MySQL 代码设置视图?
I'm new to drupal, and having a tough time getting a view to work (see this question).
Since I can't figure out how to do this with Views, and since getting this done in code is usually a piece of code, is there a way I could bypass the Views UI interface entirely and set the view with normal MySQL code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
hook_views_query_alter允许您更改视图运行的查询。 db_query 是您执行自定义查询的方式,尽管 Drupal 的数据库结构不是固定的,因此,如果您是打算这么做。不过,我认为您原来的问题有一个更简单的解决方案,我将其留在那里。
hook_views_query_alterallows you to alter the query run by views. db_query is how you do custom queries, though Drupal's database structure isn't fixed, so you should look at something like this article if you're going to do that. I think your original question has a simpler solution, though, which I'll leave there.
您可以尝试此模块:http://drupal.org/project/qviews
You might try this module: http://drupal.org/project/qviews