开发者

drupal replacing default nodes with views page

开发者 https://www.devze.com 2023-02-28 19:44 出处:网络
I have created a page view using field style to display a list of teasers as I want. fields configuration in views allows us to link the field to it\'s node. but what if we have created view for 开发者

I have created a page view using field style to display a list of teasers as I want. fields configuration in views allows us to link the field to it's node. but what if we have created view for 开发者_JAVA百科node detail page and want field to link to it's relevant view.


I had the same question, and after a bit of research this is what I've concluded:

The views module isn't intended to replace a default node view. I say this because of the level of difficulty involved in doing this and the lack of information on how to accomplish this. Ryan Weal has posted a way to accomplish this by editing your node template that doesn't look too difficult to accomplish, and here is the link.

However, it seems that a more popular solution, especially if you are like me and don't like to get into editing theme files. You can use the Display Suite module to effectively reformat the default node content as you would like.


I'm not sure if I understand you properly, but it sounds like you are wanting to display a view in a page view of a node?

In order to do this, you could:

  • create a small module, using hook_nodeapi() or one of the D7 replacements for this function in order to insert the output of the embedded view into this page's content, by conditionally adding a $content element when the node is of the appropriate id

  • or (easier, but requires allowing input type PHP) embed the view right on the page.

http://thedrupalblog.com/embedding-view-drupal-6-using-views-embed-view for information on embedding views

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号