0
votes

as the title says I'm trying to create a view that displays rendered files and nodes together. Normally when you create a view you have to select what type of content (nodes, taxonomy, files ...) you want do display.

What i want to achieve is a view that displays all nodes and files. The files are NOT mandatory associated with a node. But they are also tagged with terms.

Any idea how to solve that?

Thanks in advance, Fab

2
Views can only query one type of entity at a time, that's just the way it's built - Clive

2 Answers

0
votes

Why don't you create 2 block views and then display it in a page?

For example:

  • Create a view block that displays the files --> "display_files-block"
  • Create a view block that displays the nodes--> "display_nodes-block"

and then print them in a static page u create,

For example: "Display files and nodes", with id 1.

inside page--node--1.tpl.php write:

$block = module_invoke('views', 'block_view', 'display_files-block');
print render($block['content']);

$block = module_invoke('views', 'block_view', 'display_nodes-block');
print render($block['content']);
0
votes

This doesn't answer the question correctly but can be used as a work around for getting data from two entities to appear in one view.

Through the UI, you could create a view called FilesAndNodes, and only add Global:Custom Text Area under the fields section.

Then create another view called Files, and add this view under the Header section of FilesAndNodes view.

And then do the same for nodes.

The Block created by the FilesAndNodes view can then be added to the page, and the content appears as one view.