Hi,
I'm trying to work out how to embed a view using views_embed_view and for the view to display depending on node reference.
I have this in my template file...
$viewName = 'introduction';
print views_embed_view($viewName,'default');
...which displays fine, but I need to add a contextual filter. The content type 'introduction' is using node reference to associate with the content type I'm trying to embed it on called 'main'. When I try adding a contextual filter with the following nothing shows up:
Content: Referencing Main (field_main_ref)
Appears in: node:introduction.
There is a message when trying to add the contextual filter that reads "This display does not have a source for contextual filters, so no contextual filter value will be available unless you select 'Provide default'." but I'm not quite sure exactly what I need to do.
Could anyone help?
Thanks for any help, I appreciate it.
Comments
Comment #1
dawehnerI guess you have this kind of code in a node.tpl.php. Why not just use the nid of the node of the node.tpl.php as argument.
So at the end you have something like
Comment #2
Jboo commentedThank you dereine, I really didn't think it would work as simple as that!
Thanks for the help, all seems to work fine now.