2

enter image description here

The above image is from Views Table. The values inside Name is title field so it is clickable by default and links to its Node. I want to make the values inside Nick Name and Age clickable link too, which will go to the same Node as its title.

I went to Nick Name field and did Rewrite Result and Output this field as a link, but in Replacement Patterns there is no Token for link, still I tried with [title], [title:url], [path], [view_node], etc. but it cannot be linked to its Node.

4
  • maybe I am missing something, but when you look at the configuration of the "Nick Name" and "Age" fields, you don't see a "Link to node" or "Link this field to the original piece of content" or some similar checkbox?
    – Jimajamma
    Commented Nov 19, 2013 at 5:28
  • No, I don't... I added the field to view normally but there is no such checkbox. should there be?
    – user12947
    Commented Nov 19, 2013 at 8:15
  • @Jimajamma, now I know what you mean, I see that Checkbox while adding "content: Nid" field. I don't see it while adding other fields
    – user12947
    Commented Nov 19, 2013 at 8:57
  • sorry, my bad, I keep forgetting d7 and entities/fields are a lot more complex (title and nid are directly node fields)
    – Jimajamma
    Commented Nov 19, 2013 at 9:23

2 Answers 2

1

You should add a nid field and then select the option to exclude from display. Arrange it so that the nid field is at the top in the list. (This is needed so that the rest of the fields can use this field in replacement patterns.)

Next when you are rewriting the result give the link as node/[nid]

That should do it.

5

You need to first add a path field to your view, and then exclude from display:

  1. Add the field "Content:path" to your view as the first field in the list
  2. Exclude "Content:path" from display
  3. Under "Rewrite results", enable "Use absolute link (begins with "http://")"
  4. For Nick name, choose "Output this field as a link"
  5. For "Link path", use the [path] token

Repeat #4 and #5 for age if you like

It's important that the path field be listed first (or at least before Nick Name and age) or it won't be available as a token.

Also note that you must use an absolute link for Content:path under Rewrite Results. It's a little counter-intuitive, since the field is being excluded from display, but the setting is still used in the [path] token.

7
  • I did the same as you said, but [path] gives me only the half url. Eg: if the link is localhost/girls/daina using [path] token as you said gives only girls/daina. I tried clicking Absolute url and external url still it didn't change. Any hints?
    – user12947
    Commented Nov 19, 2013 at 8:36
  • Sorry, I missed step #3 in my original answer (now revised to include). I believe the updated answer should work for you.
    – Dave Bruns
    Commented Nov 19, 2013 at 16:28
  • @Jhilke Dai - Did you get a chance to try this? Just want to make sure the instructions are good.
    – Dave Bruns
    Commented Nov 20, 2013 at 18:05
  • @DaveBurns, I have already tried your solution even before you mentioned about step 3, I wrote that in my previous comment. Even when I tried absolute URL it gives me only the path like I mentioned in previous comment. I tried flushing the cache too, but couldn't get the result I was looking for. But you were right that I had to put the Field before, as I did with Node Id. Putting [nid] was easier solution as I am also using pathauto and redirect module
    – user12947
    Commented Nov 20, 2013 at 19:51
  • I wasn't sure that you had set absolute URL on content:path and not Nick name (which didn't work in my testing). Sorry it didn't work for you.
    – Dave Bruns
    Commented Nov 20, 2013 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.