1

I'll start off saying I'm pretty new to Drupal. I'm trying to customize the way a view displays. I want it to look like the Industry News section on this page: http://www.silverfishdevelopment.com/clients/maafs

However I'm confused as to what I want to actually edit. Do I want to create a custom views-view.tpl.php file? Or style output, or row style, etc?

And if I create a new tpl file, what are the variables I can use?

I was trying to follow this: http://www.wdtutorials.com/2011/06/29/drupal-7-how-create-custom-template-view#.VPXOIXXN9cY but couldn't get it to print out the $fields data.

Or am I approaching this all wrong?

If you know of a great tutorial too I'd appreciate that as well. I'm a little overwhelmed with all of it. Thanks for any help you can give.

2 Answers 2

1

I found that Semantic Views worked best for me in this situation. It cuts down on the amount of HTML outputted by Drupal Views and allows you to define the HTML tag that wraps each field as well as add a CSS class.

0

The bulk of your HTML can be controlled via the Manage Fields section of your content type that you are displaying.

To add a bit more flexibility and configuration option to your content type, you can install Display Suite.

After installing DS and DS extras, you can enable "Field Templates" in DS settings. This will allow you to change the HTML for each of your fields.

This way, views just simply displays your data rather than controlling its appearance. You would set your view to show "Display Suite" with whatever view mode you choose. I think this is a better route when new to Drupal.

If you'd rather go the views template route, you can see a couple starting points by going to "Advanced > Theme: Information" in your view settings. You can also check out This LInk that explains what template names to use.

2
  • Ok, another question then. If I use DS how do I change just the first news article to look different?
    – Gamegoofs2
    Commented Mar 3, 2015 at 22:03
  • In that case, you would set your views block to show just 1 article (the top one). Then create an attachment display and attach it to the single article display. The attachment display would be the one that displays the list of teasers. Commented Mar 3, 2015 at 22:20

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.