Drupal - 将内容分解为不同的内容(每 12 个产品后,显示一个广告?)
目前,我有一个 T 恤网站的主页,其中列出了 4 列网格,每个单元格包含网站上的所有衬衫(使用视图)。客户希望每隔几行显示一个广告(可能是随机视图/阻止项目)。这可能吗?我确信我最终需要将网格显示设置为其他内容,但我该如何对其进行编程呢?
Currently I have the homepage of a t-shirt site list a 4 column grid, each cell containing all the shirts on the website (using views). The client would like every few rows to display an ad (perhaps a random view/block item). Is this possible? I'm sure I will end up needing to set the grid display to something else but how could I program this in?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可以通过使用视图模板来实现。
在您的视图显示中,您可以创建自定义 tpl 文件。这些可以在主题部分找到(单击信息)。
如果您在 tpl 样式的 foreach 循环中添加计数,那么在 $i 达到某个数字后,您就可以打印广告或自定义文本。
This would be achievable by using views templates.
In your view display you can create custom tpl files. These can be found in the theme section (click on Information).
If you add a count to the foreach loop in the style tpl then after $i hits a certain number you can then print your ad or custom text.