I am using tokens to insert the value of custom CCK fields into content. For example, I use the code [token node field_boy-raw] to insert the name of a boy into story text. This works very well when viewing the whole node.

However, when using a View (for example the frontpage view), the code only evaluates properly in the teaser for the top entry in the page (i.e. for the node at the top of the view). All the nodes listed below show the code not the value. On opening up the whole node, however, the code evaluates properly.

It is sensitive to ordering - if I re-order the nodes (by making another one sticky at the top) then the code evaluates properly for that one, but not for the others below it.

I have checked the database - the teaser text looks right (i.e. identical to the full node text). And all the codes evaluate properly when the node is expanded.

I would be so grateful for any clues as to how to sort this out. Thanks.

Comments

iamjon’s picture

Status: Active » Postponed (maintainer needs more info)

rupyjl,
did you ever find a solution for your issue? if yes please update so others can benefit.
if not, please provides step by step instructions for your issue using common fields and content types and an export of your view.

rupyjl’s picture

Yes - sorry. I did get this sorted out - although my original post reflects my very early days with Drupal. Getting better slowly.

I had a lot of CCK text fields that I wanted to insert into the text of posts. I write stories which can be personalised by the user, so in their content profile they can enter names and places of their own, which then get rendered at specific points in the story. The issue for these fields is they need default values if the user has not set any values in their profile, and if they have changed their profile the new values need to be inserted.

The way I worked through this was to create a token for each field (using the Custom Tokens module). The token pulls out the value in the current user's CCK field if they have entered one, and uses defaults if they have not.

In the text I then just insert a reference to the custom token which is then populated with a default value if the user has not entered anything, and with their value if they have.

dawehner’s picture

Status: Postponed (maintainer needs more info) » Fixed

So this is fixed

Status: Fixed » Closed (fixed)

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