O'Reilly logo

Drupal 7 Theming Cookbook by Karthik Kumar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Embedding a View inside a node template

Views usually tend to be output as pages, blocks, and other displays. In this recipe, we will be looking at taking this a step further, by manually embedding a View inside a node template using a smidgeon of code. To be more precise, we will be taking the backlinks View which comes with the Views module and embedding it inside a theme's node template file to provide a list of related content which links to the node currently being displayed.

Backlinks provide a list of nodes that link to the current node. For example, if in the content of node/123, we include a link to node/456, node/123 is considered to be a backlink of node/456.

Getting ready

As we are going to be embedding the backlinks View, it is assumed ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required