Is it possible to Insert a view in a content type in drupal 7? Is so can you help me do that?
4 Answers
The Entity Views Attachment module is the successor of the Views attach let you attach the output a view to the content of any entity.
There is also http://drupal.org/project/viewfield which gives you CCK fields of "view" type. Like, you add a viewfield field to a content type, and for every node of that type you can choose a view and parameters to add to the node.
In addition to Pierre Buyle's answer
Let's say you have a content type named 'Product'
You want to attach a view to it.
Here are the steps using the Entity Views Attachment (eva) module :
On your view edit page :
Section Displays
+Add : Eva field
Section ENTITY CONTENT SETTINGS
Entity type:Node
Bundles:Product
That's it : Going to a node product type will now display the view
Nota : You can choose where it is displayed among your content type fields here : /admin/structure/types/manage/[your_content_type]/display
-
I Don't see nothing. I have added a view to get a list of news. I have added eva. I have added Eva field to my news view. i have selected Node as Entity type, and homepage as bundles. The news doesn't show up on my homepage nor in the manage display. nor on the homepage entity field values Commented Mar 30, 2015 at 18:31
Use PHP input filter for the content and use the following snippet:
$view = views_embed_view('views_machine_name', 'display_id');
print $view;
To get the display_id, hover the display option in the view, e.g. page, block, default etc. At the bottom of your browser, you'd see a url. display_id would be of the form: page_1, block_1, block_2, default.
For more control, you may use:
// This would return an object of view.
$view = views_get_view('views_machine_name');
//print_r($view) to get the available data.
You may also have a look at Insert view module.