Passing Arguments

mrtbc - January 28, 2009 - 11:45
Project:Viewfield
Version:5.x-1.5
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Any help with this would be very gratefully received.

I have 3 node types:

Films, Reviews, and Articles:

The Node Title for Films is e.g. "Fight Club"
The Node Title for Reviews is e.g. "Fight Club Review" or "Review of Fight Club"
The Node Title for Articles is e.g. "A Critique of Fight Club in Relation to Post Modernity"

I have installed the ViewField module and created a View. This View displays up to 5 nodes which are Reviews or Articles and works correctly. I have embedded this View into every Films node using the ViewField module. I have made this the default View and stopped users editing the node from being able to see this.

What I now want to do is pass the Node Title from the current Films node to the View as an argument. The View should then search for nodes where the Node Title contains *fight club* (using wildcards).

Please could someone give me the steps required to pass the Node Title across as an argument and filter by it in the view?

Thanks very much.

#1

mrtbc - January 28, 2009 - 12:11

Sorry, I should have added that I don't want to pass arguments using the URL.

#2

mrtbc - January 28, 2009 - 13:05

Hmmm. OK, it looks like I am doing this correctly as I was able to successfully use a Node Author argument - and yet for some reason Node Title doesn't return any records...

#3

mrtbc - January 28, 2009 - 14:16

I can make this work if the Node Title is an exact match, so the issue is how to surround the Argument with wildcards (or something similar).

#4

mrtbc - January 28, 2009 - 14:58

Fixed.

#5

matytsio - June 11, 2009 - 23:31

How?
I have a similar project, and would like to know how you solved this issue.

#6

mrtbc - June 12, 2009 - 07:29

1. In the Arguments for the Viewfield I added [title-raw]
2. In the View itself I added the first Argument as Node Title contains "test"
3. In the Argument handling code for the View I added:

$view->filter[0]['value'] = $args[0];
$view->is_cacheable = 0;

Hope this helps.

#7

matytsio - June 18, 2009 - 17:40

I've been trying to get this figured out but don't seem to get it... any help would be greatly appreciated.
Drupal 5.
I have 3 custom content types:

* People (name, phone, etc.)
* Committees (name, email)
* Committee Memberships (person_reference, committee_reference, position_title, date)

The Committee Membership type had node references to the other two.

I need to construct a page that displays all Committees with the People in each one. This page would show some other information displayed besides the Person's name and Committee's name, i.e. other data from these two tables. For example:

CommitteNameA - email
PersonName1 - PositionTitle - Phone
PersonName2 - PositionTitle - Phone
CommitteNameB - email
PersonName3 - PositionTitle - Phone
PersonName4 - PositionTitle - Phone

Is this doable with Viewsfield?

 
 

Drupal is a registered trademark of Dries Buytaert.