Author Topic: adding a line break after a variable changes  (Read 148 times)

michalis

  • New Member
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
adding a line break after a variable changes
« on: July 22, 2012, 01:46:02 PM »
hello guys, I am new to php and only took it up recently when I decided to start my own website

I am using joomla cms to administer the website and I have this software that lists sports games, which are group according to category

at the moment all game appear as one big list, what I want to do is add a break between each category, here is a part of the code

PHP Code: [Select]
	
	
	
<
tbody>
<?
php for ($i=0,$k=0,$n=count($this->items); $i<$n$i++,$k=1-$k): ?>
	
	
	
<tr class="<?php echo "row$k"?>">
	
	
	
	
<td class="secenter"><?php echo $this->items[$i]->cat_name'<br />'$this->items[$i]->date?></td>
	
	
	
	
<td width="30px" align="left">
<?php  if (empty($this->items[$i]->t1_flag)): ?>
	
	
	
	
	
	
&nbsp;
<?php else: ?>
	
	
	
	
	
	
<img height="13px" width="19px" src="<?php echo JURI::root(TRUE).'/components/com_sportspredictions/images/'.$this->items[$i]->t1_flag;?>" />
<?php endif; ?>
	
	
	
	
</td>
	
	
	
	
<td class="secenter" width="1%" nowrap="nowrap"><?php
	
	
	
	
	
echo empty(
$this->items[$i]->descr) ?
	
	
	
	
	
$this->items[$i]->t1_name.' - '.$this->items[$i]->t2_name :
	
	
	
	
	
'<a href="'.JRoute::_('index.php?option=com_sportspredictions&view=match&id_mat='.$this->items[$i]->id_mat).'">'.$this->items[$i]->t1_name.' - '.$this->items[$i]->t2_name.'</a>';
	
	
	
	
?></td>
	
	
	
	
<td width="30px" align="right">
<?php  if (empty($this->items[$i]->t2_flag)): ?>
	
	
	
	
	
	
&nbsp;
<?php else: ?>
	
	
	
	
	
	
<img height="13px" width="19px" src="<?php echo JURI::root(TRUE).'/components/com_sportspredictions/images/'.$this->items[$i]->t2_flag;?>" />
<?php endif; ?>
	
	
	
	
</td>
	
	
	
	
<td class="secenter" nowrap="nowrap">
	
	
	
	
	
<input type="text" name="predictions[<?php echo $this->items[$i]->id_mat?>][1]" style="width:20px" maxlength="2" value="<?php echo $this->items[$i]->prev_equipe1?>" />
	
	
	
	
	
:
	
	
	
	
	
<input type="text" name="predictions[<?php echo $this->items[$i]->id_mat?>][2]" style="width:20px" maxlength="2" value="<?php echo $this->items[$i]->prev_equipe2?>" />
	
	
	
	
</td>
	
	
	
</tr>
<?php endfor; ?>
	
	
	
</tbody>


the $item is a single game and the cat_name is the category name, every item/game belongs to a category

I am assuming that cat_name is a variable

is there a piece of code I can add that will add a break at the end of this code every time the cat_name variable changes?