Closed (fixed)
Project:
Embed Views Display
Version:
7.x-1.0
Component:
Documentation
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
26 Apr 2011 at 14:27 UTC
Updated:
2 Nov 2013 at 00:30 UTC
Jump to comment: Most recent
Please provide more detailed instructions what to do after adding Embed to already built particular View, including exact examples.
For example, please instruct where the PHP snippet should be placed (in the manual they write that in various places). Moreover, how it should be used in the pages, i. e. whether use [] brackets etc.
I am not a developer, and the snippets are as difficult to me as to many other people (there are a lot of discussions...).
Comments
Comment #1
grndlvl commentedSorry I just saw this ticket... I will place a couple of examples for you this weekend.
Comment #2
grndlvl commentedStill coming... haven't forgot.
Comment #3
grndlvl commentedThis will what is in the 7.x-2.x release of the embed_views module.
If you need more clarification please provide a specific example of what you are trying to do and lets see if we can't figure it out.
Documentation
To figure out the id of a display, look under Other, in the
view edit page for the particular view that will be embedded, for Machine Name:
what ever this name is is what should be used for the $display_id variable.
Usage
Embedding a view
The best way to use embedded views is to create your own module and integrate
with which ever system you need to within Drupal, specifically
hook_codeprocess_HOOK()
You can easily embed the results of a view into other parts of your site;
either, with code as a module, or in nodes or blocks as snippets. The
easiest way is to use the function views_embed_view():
This is the equivalent of views_embed_view without arguments.
Embedding a view with arguments
This is the equivalent of views_embed_view with arguments.
Advanced examples
Embedding individual fields from a view
To retrieve a specific field from an embeded view is to use
$view->render_field($field, $row)
Using fields from nodes as arguments for views
Comment #4
AndrzejG commentedWow! Thank You. Now I have to reserve some time to study :-)
Comment #6
isaac.el.cec@gmail.com commentedThe right code for the "equivalent of views_embed_view without arguments" is:
Comment #7
drupalese4711 commentedI think there is a little mistake in the code under 'Advanced examples' - first block - foreach-loop:
$text will only return the last data from the Resultset, because it is set to an empty string in every loop-cycle.
$text = ''; should stand one line above the foreach-loop.
Please tell me, if I am wrong and thanx for the module!
Comment #8
grndlvl commentedYeah your right. Fixed now thanks.
Comment #9
rboedeker commentedThank you for this example! Very helpful!
There is a typo in "Using fields from nodes as arguments for views"
should be :
Comment #10
grndlvl commentedFixed