Hi all,

I posted this in the tokens issue queue. I would like to add a Token from the Views Replacement Patterns. Unfortunately there are only 2 'tokens' available and these are not the ones I need.

Does anyone have experience with this?

Any help is highly appreciated.
Cheers,
Danny

Comments

Poieo’s picture

I believe you'll only have access to tokens from the fields listed in the view. If you need other tokens, add a field to the view and check the box for 'exclude from display'.

danny_joris’s picture

I added node reference to image gallery and i excluded it from display, but i still don't get any good Tokens at my other field..

gbrussel’s picture

Rearrange your fields so that all the ones that are 'excluded from display' are at the top of the list. Then their tokens should be available downstream in the fields you are displaying.

danny_joris’s picture

Hmm, thanks for the info, but the result is not what I was hoping for. I only get the following tokens:

Fields
* [field_gallery_nid] == Content: Gallery (field_gallery)
* [field_photo_fid] == Content: Photo (field_photo)

I need the [field_gallery_title-raw] token, cause that is the way my image galleries (which i'm trying to link to) are built with pathauto.

Again, thanks for the support.

--EDIT: I just noticed that the output of [field_gallery_nid] is not even a node Id. It outputs the unformatted gallery name.

squid600’s picture

Hi,

independently also trying to do the image gallery nicely and ran into exactly same issue. Agree with the edit - it would seem that if [field_gallery_nid] actually was a node Id, things would work fine.

Might have a look at the source code later (haven't yet done that in Drupal so don't know if feasible :)

Thanks

MBroberg’s picture

I think Node Reference only works if you are using a Node Reference CCK field in the content type that you are trying to view.
For instance I have a course list (content type = class) and then I have occurrences of that class at different locations and times (event). I reference the class node in the event using a CCK Node Reference field. Then I can use that Node Reference field in a view.
Just putting a Node Reference in the field list is not going to help unless you actually use it in a node. I think. ;)
So if you have a Node Reference in your Image Nodes you can use it in an Image Node View. You cannot use it in a Gallery View unless you found a way to use Node Reference in a Gallery itself (which is I believe just a collection of taxonomy terms) . I hope that makes sense.

The first step to using replacement patterns is to list every field that you want to have in your view and make sure none are excluded from display. Make sure that each field you want has output in your preview.
If you don't get data, you won't get data when you use it as a replacement pattern because replacement patterns output exactly what the field would output by itself.

Once you are getting data, you can follow the instructions given (first order your fields properly in the list, then exclude from display and rewrite the lowest field to output your data the way you want.)

One issue you might be running into is that there are 2 views controlling galleries. One deals with the nodes and one deals with the galleries but both views are showing gallery displays in the preview, at least for me. So that is a little confusing.

The node-based view only controls the output when you click on a gallery and see thumbnails of the actual images in that gallery. That would have an image and the name of the image, plus whatever other fields you want on the gallery page.

The term-based view controls the gallery list page. Those fields actually control the master list of galleries and contain the last (or first) image in the gallery, the gallery title, the number of images in the gallery, the last updated date, etc.

I am just starting to make sense of this myself but I hope something I said helps.

danny_joris’s picture

hmm, this is looks complicated.

Your response triggered me to think about a solution again and I found it using "Relationships" in views. I explained my solution here: http://drupal.org/node/518398#comment-2518636 ..

Cheers,
Danny