将内容/视图添加到节点的最佳方法是什么
我正在开发一个显示视频的模块。我创建了一个所谓的导航视图,供用户从列表中选择视频。
现在我想将此导航添加到 type = 'video' 的每个节点。我不知道是否应该为它创建一个模板(然后我必须将模板文件放在主题文件夹中,这不太好)还是使用某种挂钩(我还没弄清楚要使用哪一个)?
我尝试安装 http://drupal.org/project/views_attach,但是视图仅出现在内容(标题后)这不是我真正想要的。我希望它位于标题之上。
请帮忙。我正在使用 Drupal 6 提前致谢。
I am developing a module to display video. I have created a view so-called navigation for the user to select a video from a list.
Now I want o add this navigation to every node with type = 'video'. I don't know whether I should create a template for it ( then I have to put the template file in theme folder which is not so good ) or use some kind of hooks ( I haven't figured out which one to use ) ?
I tried to install http://drupal.org/project/views_attach, however the view only appeared in the content (after Title) which is not what I really want. I want it to be on top of the title.
Please help. I'm using drupal 6
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
听起来您只需通过多种方式创建导航块,并告诉该块仅在显示规则中使用 php 显示在视频节点类型上。也许 menu_block 模块可以在这里帮助你。
Sounds like you'd just create the navigation block any number of ways, and tell the block to only show on video node types using php in the display rules. Maybe menu_block module can help you here.
您可以使用
views_embed_view
在节点模板中的任何位置渲染视图。创建特定于您的视频节点类型的模板:
node-video.tpl.php
并将视图插入到您想要的位置。You can render the view anywhere you want in your node template with
views_embed_view
.Create a template specific for your video node type:
node-video.tpl.php
and insert the view where you want it.如果您不想通过模板文件来完成此操作,则可以使用面板模块为每个节点类型提供不同的布局。安装后,在 node_view 面板下创建一个变体,并限制为“视频”类型的节点选择该变体
If you don't want to do it via template files, the Panels module can be used to have different layouts per node type. Once you install it, create a variant under the node_view panel and restric that variant to be selected for nodes of type 'video'
我终于找到了如何将视图实现为块(只需选择块作为内容视图),并且我使用下面的代码来显示特定节点类型中的块
I finally found how to implement a view as block (simply select block as a content view) and I use this code below to display a block in a certain node type