0

I have a view named studies that displays title, status. The status field should be "Active" or "Completed". This value is the result of comparing the timestamp of the date field that my content type has with the today timestamp. So I added the date field to my view as well, but choose to have it excluded from display. Then I created a global text field with the label "Status".

Then i tried taking my first steps into theming. What I need is to override the content of the Status field with either "Active" or "Completed" based on my code. I created a template called views-view-field--studies--nothing.tpl based on the suggestions of the Views theme information. The problem is that it doesn't matter what I write inside nothing gets displayed, not even just a simple <?php print $output."Hello World"; ?> (I did rescan the template files and Views sees my template, plus I flushed all caches)

My view right now has table style. I changed the style to unformatted list and voila the Hello World showed up! So am I messing around with the wrong template? Do I need to create a template for the table style of my view? Seems too excessive when I only need to override the content of one field.

2
  • What version of drupal is this?
    – acouch
    Feb 20, 2012 at 15:16
  • Working with Drupal 7.10
    – Perisdr
    Feb 21, 2012 at 9:00

2 Answers 2

0

What you are trying works fine for me under drupal6, so, I'd look at your theme information again and be perfecting sure that it is looking at the right theme when you switch styles from table to unformatted and so forth. I did that once and had my views template file sitting in one theme and couldn't figure out why views wasn't picking it up in another :)

0

Not really sure what could have fixed the problem, but after many cache flushes I can now see the template working correctly. So there was nothing wrong with my workflow.

Your Answer

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

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