I have a page view that is a destination from a menu link (cannot have an argument in URL). The page view shows the most recent node for a content type (descending sort, limit display to 1). There's an attachment view to this page which requires an argument to display referenced nodes. I cannot figure out how to pass the node ID of the page view to the attachment if there's no argument in the URL. Any ideas?

Comments

merlinofchaos’s picture

Oooh this is a tough one. You're probably going to have to use PHP code somewhere in the view to store the nid in a global, and then use PHP code in the argument default to pull that nid out of the global, because at the moment there is no mechanism to pass data loaded from a view into an attachment.

milehighlife’s picture

Thank you! This is exactly what I did. I setup a db_query to get the most recent nodeID and return as a default argument.

ordually’s picture

Milehighlife,

I have the same issue, but am unclear on where to add the PHP code to the page view. If you could post what you changed to make this happen I'd really appreciate it!

Ord

Letharion’s picture

Status: Active » Fixed

Unforunatelty milehighlife doesn't seem to be returning to this issue, so I'm closing it.

Status: Fixed » Closed (fixed)

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

willyk’s picture

Have there been any updates to Views that would support the ability to pass a nid/values from a view display to an attachment?

Also mentioned here: http://drupal.org/node/1185860

nigelcunningham’s picture

Status: Closed (fixed) » Active

Hi.

Oooh this is a tough one. You're probably going to have to use PHP code somewhere in the view to store the nid in a global, and then use PHP code in the argument default to pull that nid out of the global, because at the moment there is no mechanism to pass data loaded from a view into an attachment.

Sorry to reopen an old issue, but I think it just needs some more info to continue to be useful.

Would that be using customfield? I'm trying to do the same thing, and have done a ton of Googling and watching videos, but am still stuck :). My current views on the front page of TuxOnIce.net have each release with the associated files; I just want to show the most recent release of each type.

I have a content type Release, and another content type File, with a nodereference linking Files to Releases.

I have the release types using a taxonomy field (no problem there), and have multiple blocks defined in the view I'm working on, which are the same apart from the taxonomy term filtering for the release type (limited to showing 1 item, sorted in descending order by date). I'm seeking to put a views attachment below each one that will show the associated files. This is the bit I'm stuck on.

kars-t’s picture

Status: Active » Closed (won't fix)

Dear fellow Drupal enthusiasts,

This issue is now lasting for a very long time in the issue queue and was unfortunately never solved. As Drupal is a open source project, everyone is helping on a voluntary basis. That this was not solved is nothing personal and means no harm. But perhaps no one had time to deal with this issue, maybe it is too complex, or the problem was not described comprehensibly.

But this issue is not the only one. There are thousands of issues on Drupal.org that have never been worked on or could not be processed. This means that we are building a wave that is unmanageable and it is a problem for the Drupal project as a whole. Please help us keep the issue queue smaller and more manageable.

Please read again, "Making an issue report" and see if you can improve the issue. Test the problem with the current Core and modules. Maybe the problem doesn't exist anymore, is a duplicate or has even been solved within this issue but never closed.

Help can also be found for it on IRC and in the user groups.

In order to close this issue, I have set this issue to "Closed (won't fix)".

If there is new information, please re-open the issue by changing the status to active.

--
This issue was edited with the help of Issue Helper