Drupal 7 Views Module Tutorial 5 of 10: Theming Views

Web Development Tutorials · 36K views · 2013 · 20:46

Open on YouTube

Web developmenttutorialdated

Why Drupal Answers Stack Exchange recommends it

Drupal Stack Exchange users link it when they need a walkthrough of Views theming, especially choosing between tpl file overrides and template.php functions.

Recommended by 2 people across 2 different months, 2014 to 2015.

What it is

A 20-minute screencast, part 5 of a 10-part series on the Drupal 7 Views module, covering how to theme views. It creates a custom theme rather than editing Bartik, then covers field-level CSS, custom tpl files, and overriding them with functions in template.php. Presented by the Web Development Tutorials channel.

What people said

Recommends cayerdis · 2014-03 · Drupal Answers Stack Exchange · on “How to add link internal or external to an image in a view for a slideshow?”

I solved using theming in the view. I use the template in the image field. I ended up with a template like views-view-field--field-slideshow-image.tpl.php. <?php //dpm($row); only work if devel module enabled $url=''; if (!empty($row->field_field_link_in_picture_)){ $url=($row->field_field_link_in_picture_[0]['raw']['url']); } if (!empty($url)) { echo "<a href='$url'>" .$output ."</a>"; //print image with link } else { print $output; //print image } ?> If someone knows a better way to do this please feel post it here. If I am not doing something in the Drupal way please let me know or you have another way to accomplish this. I would love to hear it :) If you know little about theming views y

Recommends Brian Huether · 2015-10 · Drupal Answers Stack Exchange · on “Which Views template file to override to display fields in formatted table?”

There is, but I can't figure out if I need to make my customizations in one of the view templates (such as style output) or if I should add a function in template.php (as described about 15min in here [this video]

Cites Luka · 2014-08 · Drupal Answers Stack Exchange · on “Preprocessing function for specific view by name”

I have been trying for a couple of days and this solution is not working. The function function bartik_sub_theme($existing, $type, $theme, $path) { kpr($theme); } isn't being called. In a tutorial I watched ( [this video] ) the guy just defines the preprocessing function and that is it. Even the Devel modul is suggesting theme_hook_suggestion (String, 22 characters ) views_view__front_page I really don't know what I am doing wrong. Any idea?