FINAL UPDATE
Success! Apparently there were field-level permissions set on several of the CCK fields I needed, in spite of the original developer telling me that content permissions were not enabled. Once I allowed anonymous viewing of the required fields, they displayed with no problem.
I've created a view with a block display. The view has a grouping field, and in the views ui preview, the output displays as grouped by that field:
When I display the block using my template, though, it's not printing out the grouping info (Advanced Learning Session or General Session). That field is not a standard one, like title - it's a CCK text field on my content type. How do I access that field in my template? I've tried the solutions shown here to get a list of available fields, but none of them work.
Edited after trying @schnippy's answer
When I mouse over the field, I see this:
So I tried adding
<?php print "session type: ".$fields['field_session_type_value']->content; ?>
to my template, but although the "session type:" string prints, there's no value coming through after it. I've also tried writing just the value to the error log, in case there was something weird about combining it with a text string, but still nothing.
Edit again...
Just to provide a bit more info, if it will help - I'm using the mobile jquery theme, which has a views-view-list.tpl.php file to display views where the output is HTML List. That template looks like this:
<?php
// $Id: views-view-list.tpl.php,v 1.3 2008/09/30 19:47:11 merlinofchaos Exp $
/**
* @file views-view-list.tpl.php
* Default simple view template to display a list of rows.
*
* - $title : The title of this group of rows. May be empty.
* - $options['type'] will either be ul or ol.
* @ingroup views_templates
*/
?>
<div data-role="collapsible">
<h3><?php print $title; ?></h3>
<<?php print $options['type']; ?> data-role="listview">
<?php foreach ($rows as $id => $row): ?>
<li class="<?php print $classes[$id]; ?>"><?php print $row; ?></li>
<?php endforeach; ?>
</<?php print $options['type']; ?>>
</div>
I have a number of views that are being displayed via blocks with this template, and for the most part it's fine because they all are grouped by a title field. But for one view, the records are grouped by a CCK field called field_session_type_value, and if the value of that field matches a specific value, I want to print that field instead of $title
.
Another update
According to views-view.tpl.php, $rows is the variable that views sends out as the results of the view query. Now, if I have multiple fields, I would expect that doing a print_r on $rows would return a multi-dimensional array - each record or row would be an array containing a key/value pair for each field. Like so:
Array (
[0] => array('title'=> 'Advanced Consumer and Shopper Insight - An Interactive Symposium',
'session' => 'general-session'),
[1] => array('title' => 'Creating a Powerful Brand One Dirty Job at a Time',
'session' => 'advanced-learning')
)
(Yes, I realize my pseudocode array is not formatted correctly. But you get the idea.) But that's not what I'm getting. What it's sending back is a single-dimension array, containing just the titles:
Array (
[0] => Advanced Consumer and Shopper Insight - An Interactive Symposium
[1] => Creating a Powerful Brand One Dirty Job at a Time
)
What do I need to do to make sure it sends all the fields through in the $rows array?