By Cyclist72 on
When using Drupal 5.7 you can insert views into nodes using the code
<?php
//load the view by name
$view = views_get_view('sample_view');
//output the view
print views_build_view('embed', $view);
?>This doesn't seem to work in v6.2 anymore. Does anybody know how you have to modify the code to get this working in D6? Help would be apprediated! Thanks a lot in advance.
Comments
...
see views_embed_view().
.
from an example i found:
how do you take out items from the embeded view? tried to take a title field as an argument but it didnt work
...
I don't understand how 'take out' and 'take as' can coincide. I'd suggest you create a new 'display' in your view with some items 'taken out' and tell views_embed_view, by the $display_id parameter, to use this display.
hm
it was a great idea..
however 'Fields' doesnt seem to be unique for each 'display'
i added two 'displays' called 'Title' and 'Body'
In 'Title' i created a field 'Node: Title'
changed to display 'Body' and added 'Node: Body'
Saved, and looked through all displays.. both 'Node: Title' and 'Node: Body' was in all of them..
can this be changed so every Display is unique? i thought that was the point with different 'displays'..
...
Click the 'Override' button to make them unique (you see this button after you click the 'Fields' header.)
That's true, settings in different 'displays' can be made independent. The 'Override' vs 'Default' behaviour is explained in the 'What are overrides?' section in the online help.
Thanks a lot for your help,
Thanks a lot for your help, it works perfectly now!