First off sorry for what my searches appears to be a popular issue. But I can't find the exact solution.
I have 2 content types, Site and Circuit. Using Node reference to associate the specific nodes to eachother.
I've got the view embedded for the content type. I'm trying to get only the circuit's associated with the site to show in the embedded view. I did this with the $args[0] = arg(1); and argument pointing to the noderef in my 5.x but I can't get this to work in 6.x

I got the argument to in preview but not for the embedded 'live' node. On my live it gives me a table with all circuits.

Also I'm using Node ID from the URL, but if I decide to use Path later, will NodeID no longer work?
I'm using nodeID just to get to a solution, if there's another way I'm open to it.

Any help would be great. Thanks.

$view = new view;
$view->name = 'Circuit_List';
$view->description = 'Circuit List for embedding in Site details';
$view->tag = 'embed';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'title' => array(
'label' => 'Circuit ID',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'field_circuit_site_nid' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'node',
'validate_fail' => 'not found',
'break_phrase' => 0,
'not' => 0,
'id' => 'field_circuit_site_nid',
'table' => 'node_data_field_circuit_site',
'field' => 'field_circuit_site_nid',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
),
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_fixed' => '',
'default_argument_user' => 0,
'default_argument_php' => '',
'validate_argument_node_type' => array(
'site' => 'site',
'circuit' => 0,
'cluster_member' => 0,
'firewall' => 0,
'gateway_cluster' => 0,
'page' => 0,
'router' => 0,
'serv_provider' => 0,
'site_sec' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'circuit' => 'circuit',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'Circuits');
$handler->override_option('style_plugin', 'table');
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'circuitlistembed');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));

Comments

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

How to you "embed" the live view? Is there some php code involved?

thinguy’s picture

Using

$view = views_get_view('circuit_list');
print $view->execute_display('page', $args);

Thanks

dawehner’s picture

Status: Postponed (maintainer needs more info) » Fixed

better use

print views_embed_view('circuit_list', 'page', $arg1, $arg2);
thinguy’s picture

Status: Fixed » Postponed (maintainer needs more info)

Thanks trying that now, but nothing shows in the embed with that.
In Views/preview if I pass an argument -nodeID it works

dawehner’s picture

Did you set $arg1 and $arg2?

$arg1 should be the nid.

thinguy’s picture

Sorry, but how do I set that in views now?

dawehner’s picture

It's your php code.

thinguy’s picture

I put $args[1] = arg(2); in the argument that provides a place for Php code
But I get nothing in live pages and the correct values in preview

thinguy’s picture

I'm setting an argument on the nodereference field
Picking "Provide default argument"
"Node ID from URL"
Validator =php code with $args[1] = arg(2); set
This way I get no responses from preview or live

If I set Node Argument type to PHP code and use $args[1] = arg(2);
I get nothing also

Not sure what I should be setting.

dawehner’s picture

Category: task » support

Better read the description instead of old views for drupal5 documentation :)

The argument to validate will be "$argument" and the view will be "$view". You may change the argument by setting "$handler->argument
thinguy’s picture

Category: support » task

Sorry for being dense, I have adv help installed but it gives descriptions of the fields and not examples.
Can you tell me what I need to put where?

dawehner’s picture

Category: task » support

What you really need is something like this:

print views_embed_view('circuit_list', 'page', $node->nid);
thinguy’s picture

Category: support » task

what do I put/how do I build the argument

dawehner’s picture

Category: task » support

This is a support issue....

Now i don't understand anymore what you try to do.

thinguy’s picture

2 content types Sites and Circuits
Sites have a node ref to circuits.
Using a custom tpl.php I have the view embedded for the Sites content type. It should display a table under the site details with circuits associated to that site.

I've put the new code you supplied in #12 in my .tpl.php file
But what do I put/how do I build the argument?

Thanks for your patience and help on this. I had it down and working in drup5. This is a fresh redesign.

thinguy’s picture

Found a great solution. I was digging around for a solution and came across this video about view_attach with node Reference. http://mustardseedmedia.com/podcast/episode37
Between view_attach and back_reference everything is working better than I'd hoped.

Thanks for the time, both this thread and on Views.

dawehner’s picture

Status: Postponed (maintainer needs more info) » Fixed

So this is fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.