For my articles, i've added a field "external_link". If this link is set, the headline should link to an external website, and if not, the headline should open the articles detailview.

Now i have the fields of my view two fields, which are excluded from the display, the external_link, and the nid. And on the headlinefield, i can do a

"rewrite results -> output this field as a link" and write either node/[nid] or [external_link],

but how to use conditions in views, to use the external_link if set, and the node/[nid] if not set? I'm new to Drupal and i have no idea how or where to add this condition...

  • I asked basically the same thing last week -- [see the answer i approved in the other thread][1]. [1]: drupal.stackexchange.com/a/40207/3279
    – tenken
    Aug 20, 2012 at 15:37
  • thanks for the link and your answer, i think the other way was easier in my case
    – sinini
    Aug 20, 2012 at 20:23

1 Answer 1


There is no direct way of using conditionals inside of Views. However, you might be able to fake it out with something like this:

  1. Order the fields in your view in nid, external link, title order.

  2. In your external link field, set empty field behavior to node/[nid]

  3. Always use it as the link in the last rewrite.

In my just woke up and enjoying espresso before getting to some real work state of mind, this should do what you are asking for, eg, linking to node/nid if there is no external link, but using it if it exists.

  • thanks a lot, it helped me out, finally i used [path] (and added some additional settings like: use absolute url to remove double slashes when used in field-empty-behaviour)
    – sinini
    Aug 20, 2012 at 20:20
  • glad I could help out
    – Jimajamma
    Aug 20, 2012 at 20:43

Your Answer

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

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