Posted by talltree on December 3, 2009 at 12:11am
I'm using views to output a list of items. Made an unformated view and made a template for it. I'm using a style output template. My goal is to count how many of each type are outputed and put the number next to each type. Here is my code.
<?php if (!empty($title)): ?>
<h3><?php print $title; ?></h3>
<?php endif; ?>
<?php $i=0;?>
<?php foreach ($rows as $id => $row): ?>
<?php
$list[$i]= $row;
$i++;
?>
</div>
<?php endforeach;
$genrelist=array_count_values($list);
foreach ($genrelist as $genre=>$value)
{
$output=$genre."(".$value.")";
print $output;
}
?>This is the output that shows up:
Drama
(5)
(12)
Action
(1)
Documentary
(1)
How can I make it so it does not go to the next line and I can have the number next to the item? Some reason after genre it forces a line break. This is not a css issue. Thanks.
Comments
=-=
maybe some css setting them inline ?
I removed all css formatting
I removed all css formatting and still shows up like this. Drupal is putting extra divs and spans in there for some reasons.
Thanks for your help I
Thanks for your help I figured it out. I had to set it my field as an inline field in the views settings in row style.