I have a view that shows taxonomy terms with a relationship to show nodes that have a term reference to that term (relationship not required, aka LEFT JOIN).

For terms that don't have a matching node I would like to show an "add content" link.

The usual "no results" behavior doesn't seem work in this situation. What's the trick?

1 Answer 1


Views PHP to the rescue:

if (is_null($row->nid)){
    print '<a href=node/add/mytype?edit[field_mytype][und]='.$row->tid.'>add node for this term</a>';

I can even pass the tid through the URL and have it prepopulated on the form (using prepopulate).

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.