2

I used Views with 6 fields. I want to overwrite the output for 4 fields, and add "more >>" under one fields output, and make the "more" link to the node. I know that creating 4 template files will get that, but creating 4 template files is too boring.

Is there a way to overwrite the 4 fields in one file? If I can, could you make me an example?

3

or you can simply add a views field 'Node:Link' - you can set the text in the options of that field.

If you want to add this field to other fields, choose the 'rewrite output' option of those fields, and place the token of that current field + the token of the 'node:link' field in the output area.

Make sure you check the 'exclude from display' option for the 'node:link' field and set the field first in the field order, so the token is made available

| improve this answer | |
  • but the text is view how to instead it to more<<? – enjoylife Apr 7 '11 at 2:51
  • and i can't put the 'Node:Link' in the a label.this can't work.<a href="[view_node]">more >> </a> – enjoylife Apr 7 '11 at 2:52
  • the node link token contains the whole html for that field, so you don't need to create a link yourself. The text 'more' you can set in the options of the node link field itself – 30equals Apr 7 '11 at 7:25
1

Rather than using a tpl file, you can rewrite the field. For that, just configure the field and check Rewrite the output of this field. You can use any fields that occur prior to that one in your rewrite (details are under Replacement patterns) and HTML. If a field you need doesn't exist, just add it and exclude it from display (and move it to before the field you want to modify).

This method can get pretty cumbersome pretty fast, and isn't as nice for themers or source control as a tpl file.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.