I'm using the node hierarchy to create a site with parent nodes, each of these having multiple child nodes. I want to show a views block displaying the 'price tag' nodes on the parent node and all its descendants but only the price tags that reference the parent node.
So far I've added a CCK node reference field to the price tag content types that references the parent node. I've created a view to display the price tags and added an argument for the node reference field. Using views live preview and adding the nid of a parent gives me the correct price for that section. The last piece in the puzzle is what I'm struggling with - I need to be able to pass nid of the current node being viewed's parent. How do I go about accessing this? Do I need to add a snippet of PHP to the views default argument?
Thanks in advance.
Comments
Comment #1
jbylsma commentedDoes the re-enabled default arguments from #1263918: Views improvement: documentation, filters, and default arguments help you out at all?
Comment #2
msmithcti commentedSorry for the very late reply. As sometimes happens you have to do things in a less than ideal way to get projects completed. In this case my rather inelegant solution required the content editor to reference every child page and also the parent page they wanted to show the view on. Not ideal - but it worked.
Looking at that patch it certainly looks like it may have helped!
For future reference, something I have come across since doing this project is the Views Menu Support Module looks just the thing for this situation. You can see it in action here.
Comment #3
jbylsma commentedGlad that you got it figured out.