Drupal:如何在视图页面中显示块/区域?
我有一个视图页面,其中包含我的一种内容类型的列表。我使用 views-view-list--
来主题化页面。但是,我定义的区域/块没有显示。在其他页面上它工作正常,但在视图页面上却不行。我正在尝试在我定义的区域中显示用户登录块
。
请告诉我如何访问我的用户登录块
或我的区域以显示在我的视图上。
非常感谢您的帮助。顺便说一句,我正在使用 drupal 6。
此致,
I have a views page that contains a listing of one of my content type. I used views-view-list--<name of my view>.tpl
to theme the page. However, the region/blocks that I defined are not displaying. In other pages it works fine, but on the views page it does not. I'm trying to display a user login block
in my defined region.
Please tell me how to access my user login block
or my region to display on my views.
Your help is greatly appreciated. I'm using drupal 6 by the way.
Best regards,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我想我昨天遇到了类似的事情。例如,我试图打印一个区域,
但在来自视图的 tpl 文件内 - 无论出于何种原因,它都不会从视图 tpl 文件之一输出该区域。
我使用了这段代码:
Think i ran into something similar yesterday. I was trying to print a region, for example
but inside a tpl file that came from views - and for whatever reason, it doesn't output the region from one of the views tpl files.
I used this code:
当我写这篇文章时,D7 中更安全且可能推荐的方法是:
我尝试了@Garry,但我从 Drupal 收到了一些错误。 请参阅这里
希望这对以后的人有帮助。
As I am writing this, a safer and maybe recommended way in D7 would be:
I tried @Garry but I got some errors back from Drupal. Please see here
Hope this helps someone down the line.
drupal 中的任何页面都有基于 url 或内容类型的页面模板。因此,您必须为要显示视图页面/块的页面创建正确的页面模板。我假设您正在使用基于 url 的页面模板
Any page in drupal have page template based on url or content type . So you have to create right page template for your page where views page/block to be displayed. I'm assuming that you are using page template based on url
这对我有用,除了上面的语法需要在 (); 之后加分号;例如 print render($region);否则谢谢你的回答
This worked for me, except the syntax above needs semi-colons after (); for example print render($region); otherwise thank you for this answer
考虑到“广告牌”区域托管广告,这就是该代码段在带有 Bootstrap - HTML 标记的 Drupal 7 中的工作方式:
This is how the snippet will work for Drupal 7 with Bootstrap - HTML tags, considering that the 'billboard' region host an ad: