By phatmike10 on
Hi I have created a tracker: www.allbuyart.com/tracker I want to edit the theme so i've added a file called views-view-table--tracker.tpl.php
I want to edit the view theme so that the picture is on the left the title is on top right and the teaser is on the bottom right. I know how to build a table to do this but the problem i'm having is that I can't figure out which bit of PHP is unique to the picture, title, teaser
the theme is as follows:
<?php
// $Id: views-view-table.tpl.php,v 1.8 2009/01/28 00:43:43 merlinofchaos Exp $
/**
* @file views-view-table.tpl.php
* Template to display a view as a table.
*
* - $title : The title of this group of rows. May be empty.
* - $header: An array of header labels keyed by field id.
* - $fields: An array of CSS IDs to use for each field id.
* - $class: A class or classes to apply to the table, based on settings.
* - $row_classes: An array of classes to apply to each row, indexed by row
* number. This matches the index in $rows.
* - $rows: An array of row items. Each row is an array of content.
* $rows are keyed by row number, fields within rows are keyed by field ID.
* @ingroup views_templates
*/
?>
<table class="<?php print $class; ?>">
<?php if (!empty($title)) : ?>
<caption><?php print $title; ?></caption>
<?php endif; ?>
<thead>
<tr>
<?php foreach ($header as $field => $label): ?>
<th class="views-field views-field-<?php print $fields[$field]; ?>">
<?php print $label; ?>
</th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php foreach ($rows as $count => $row): ?>
<tr class="<?php print implode(' ', $row_classes[$count]); ?>">
<?php foreach ($row as $field => $content): ?>
<td class="views-field views-field-<?php print $fields[$field]; ?>">
<?php print $content; ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>I need to change the following part of the code but like I say, there's no unique identifier for picture, title, teaser:
<tbody>
<?php foreach ($rows as $count => $row): ?>
<tr class="<?php print implode(' ', $row_classes[$count]); ?>">
<?php foreach ($row as $field => $content): ?>
<td class="views-field views-field-<?php print $fields[$field]; ?>">
<?php print $content; ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
Help would be much appreciated.
Cheers
Mike
Comments
If you take a peek into the
If you take a peek into the $row array with print_r(), you should be able to find the specific bits you want to print, and print them directly, rather than use the $content variable inside that table cell.
Better yet, install the Devel module and you can use dpm() instead:
It'll print the entire contents of that $row array in a cleaner and more understandable way. Once you find what you need, you can get rid of $content and print exactly what you want from $row.
An alternate approach is to
An alternate approach is to use the Display Suite, make a new build mode, create the layout with Display Suite and use that in views as your row style.
Thank you for this, I change
Thank you for this, I change the code to:
as you can see at www.allbuyart.com/tracker the array names have appeared, so I altered the code to:
however it doesn't seem to work, I wanted it to just display the image.
ultimately I want something like this:
ideally i'd like to know how do the above by just altering the php/html for this file without download more modules.
thanks
Any help would be much
Any help would be much appreciated.
cheers
Mike