Skip to main content
Added explanation about views templates
Source Link
Marcel
  • 424
  • 2
  • 9

Under the advanced tab you can see what templates you need to override the views template. Copy the templates mentioned from the modules/views/themes folder to you own theme/templates folder, rename them as the view suggests under advanced and style your output.

note: if you display a teaser or full node, but forced it to use fields, the styling (making it h3) won't work.

The h3 is coded in views-view-unformatted-list.tpl.php. The $title there is output of the field you grouped by. There you can set it to h2.

UPDATE: This is the default views template for outputting lists (the container which contains all rows as a group). This one is named views-view-unformatted.tpl.php, you need to rename it to match with your view.

 <?php

/**
 * @file
 * Default simple view template to display a list of rows.
 *
 * @ingroup views_templates
 */
?>
<?php if (!empty($title)): ?>
  <h3><?php print $title; ?></h3> // THIS IS THE GROUPNAME
<?php endif; ?>
<?php foreach ($rows as $id => $row): ?> // THESE ARE THE ROWS INSIDE THE GROUP
  <div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"';  } ?>>
    <?php print $row; ?>
  </div>
<?php endforeach; ?>

If you want to put style on ALL the rows inside the group then you can use the view-ui itself, or use the template called views-view-fields.tpl.php to override all rows.

If you want to style ONE specific row use views-view-field.tpl.php (note there is no 's' behind field).

Under the advanced tab you can see what templates you need to override the views template. Copy the templates mentioned from the modules/views/themes folder to you own theme/templates folder, rename them as the view suggests under advanced and style your output.

note: if you display a teaser or full node, but forced it to use fields, the styling (making it h3) won't work.

The h3 is coded in views-view-unformatted-list.tpl.php. The $title there is output of the field you grouped by. There you can set it to h2.

Under the advanced tab you can see what templates you need to override the views template. Copy the templates mentioned from the modules/views/themes folder to you own theme/templates folder, rename them as the view suggests under advanced and style your output.

note: if you display a teaser or full node, but forced it to use fields, the styling (making it h3) won't work.

The h3 is coded in views-view-unformatted-list.tpl.php. The $title there is output of the field you grouped by. There you can set it to h2.

UPDATE: This is the default views template for outputting lists (the container which contains all rows as a group). This one is named views-view-unformatted.tpl.php, you need to rename it to match with your view.

 <?php

/**
 * @file
 * Default simple view template to display a list of rows.
 *
 * @ingroup views_templates
 */
?>
<?php if (!empty($title)): ?>
  <h3><?php print $title; ?></h3> // THIS IS THE GROUPNAME
<?php endif; ?>
<?php foreach ($rows as $id => $row): ?> // THESE ARE THE ROWS INSIDE THE GROUP
  <div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"';  } ?>>
    <?php print $row; ?>
  </div>
<?php endforeach; ?>

If you want to put style on ALL the rows inside the group then you can use the view-ui itself, or use the template called views-view-fields.tpl.php to override all rows.

If you want to style ONE specific row use views-view-field.tpl.php (note there is no 's' behind field).

Source Link
Marcel
  • 424
  • 2
  • 9

Under the advanced tab you can see what templates you need to override the views template. Copy the templates mentioned from the modules/views/themes folder to you own theme/templates folder, rename them as the view suggests under advanced and style your output.

note: if you display a teaser or full node, but forced it to use fields, the styling (making it h3) won't work.

The h3 is coded in views-view-unformatted-list.tpl.php. The $title there is output of the field you grouped by. There you can set it to h2.