A Views page with an Attachment

Is it possible to have the first argument in the url affect the main page only, and the second argument affect the attachment only?

e.g. http://url.com/%1/%2

%1 is a cck field in a node. If %1 == 'acme' the main page displays a list of all nodes where a certain cck field equals 'acme'. It then ignores the second argument (e.g. %2 can equal anything or nothing without affecting the page list).

%2 is an nid. The Views page's attachment displays a single node where the nid the value of the second argument. (Argument 1 will always be true for this node, so it can be inherited, but it doesn't have to be).

Is this possible?

I also tried by using a combination of an argument for the page and exposed filter for the attachment I could create a url like:


…but that still produced no results for the attachment.

…but that still prod


2 Answers 2


Personally, if you just want some content from the node at the top of a view, I'd override the Views template.

Then, in that template just use the following code to get the content:

<?php if (is_numeric(arg(2)) : ?>
  <?php $node = node_load(arg(2)); ?>
  <?php print $node->content; ?>
<?php endif; ?>

I'm pretty sure you can get attachments to inherit arguments, but they can't be used independently; all arguments will always affect the parent view.

If you have to use a view, you can always do as above, create a template, then create a 'new' view; then, embed that view inside the other using:

<?php print views_embed_view('viewname', 'displayname', arg(2); ?>

This will manually pass the third argument into the embedded view.


I could be wrong about this, but I believe that the first term in a view path cannot be a % (neither should the last term). The path you are defining is the identity for the view, not an intercept for the URL. In other words, The view is called when its path is called and there should not be another content item with the same URL path. You can use & as middle terms in the path and use contextual filters to read them and further filter the view. A view page can have a contextual filter and so can the attachment.

Remember that if you have two path segments with % that it takes two contextual filters to read the second one. Before expanding into all of that, could you provide some additional information about what you want to achieve?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.