2011-08-10 11 views
1

如果你能找到它,我會很高興,儘管我非常確定它的語法是正確的。 第36行引發錯誤,這是第一個錯誤。在HTML/PHP模板中出乎意料的T_ELSE

if ($this->data): ?> 
<projections> 
    <?php foreach ($this->data as $aItem): ?> 
     <projection Id ="<?php echo $this->escape($aItem['id_hits'])?>"> 
     <? if ($aItem['position'] == "Gardien"): ?>   
     <matches_played><?php echo $this->escape($aItem['matches_played'])?></matches_played> 
     <goaltender_wins><?php echo $this->escape($aItem['goaltender_wins'])?></goaltender_wins> 
     <goaltender_losses><?php echo $this->escape($aItem['goaltender_losses'])?></goaltender_losses> 
     <goaltender_losses_overtime><?php echo $this->escape($aItem['goaltender_losses_overtime'])?></goaltender_losses_overtime> 
     <minutes_played><?php echo $this->escape($aItem['minutes_played'])?></minutes_played> 
     <goals_against_average><?php echo $this->escape($aItem['goals_against_average'])?></goals_against_average> 
     <shutouts><?php echo $this->escape($aItem['shutouts'])?></shutouts> 
     <goals_allowed><?php echo $this->escape($aItem['goals_allowed'])?></goals_allowed> 
     <shots_allowed><?php echo $this->escape($aItem['shots_allowed'])?></shots_allowed> 
     <save_percentage><?php echo $this->escape($aItem['save_percentage'])?></save_percentage> 
     <rank><?php echo $this->escape($aItem['rank'])?></rank> 
     <comment><?php echo $this->escape($aItem['comment'])?></comment> 
     <first_name><?php echo $this->escape($aItem['first_name'])?></first_name> 
     <last_name><?php echo $this->escape($aItem['last_name'])?></last_name> 
     <id_team><?php echo $this->escape($aItem['id_team'])?></id_team> 
     <team_name><?php echo $this->escape($aItem['team_name'])?></team_name> 
     <position><?php echo $this->escape($aItem['position'])?></position> 
     </projection> 
     <?php else: ?> 
     <matches_played><?php echo $this->escape($aItem['matches_played'])?></matches_played> 
     <goals><?php echo $this->escape($aItem['goals'])?></goals> 
     <assists><?php echo $this->escape($aItem['assists'])?></assists> 
     <points><?php echo $this->escape($aItem['points'])?></points> 
     <points_per_match><?php echo $this->escape($aItem['points_per_match'])?></points_per_match> 
     <plus_minus><?php echo $this->escape($aItem['plus_minus'])?></plus_minus> 
     <assists_power_play><?php echo $this->escape($aItem['assists_power_play'])?></assists_power_play> 
     <goals_power_play><?php echo $this->escape($aItem['goals_power_play'])?></goals_power_play> 
     <assists_short_handed><?php echo $this->escape($aItem['assists_short_handed'])?></assists_short_handed> 
     <goals_short_handed><?php echo $this->escape($aItem['goals_short_handed'])?></goals_short_handed> 
     <rank><?php echo $this->escape($aItem['rank'])?></rank> 
     <comment><?php echo $this->escape($aItem['comment'])?></comment> 
     <first_name><?php echo $this->escape($aItem['first_name'])?></first_name> 
     <last_name><?php echo $this->escape($aItem['last_name'])?></last_name> 
     <id_team><?php echo $this->escape($aItem['id_team'])?></id_team> 
     <team_name><?php echo $this->escape($aItem['team_name'])?></team_name> 
     <position><?php echo $this->escape($aItem['position'])?></position> 
     </projection> 
     <?php endif;?> 
    <?php endforeach; ?> 
    <?php endforeach; ?> 
</projections> 
<?php else: ?> 
<projections></projections> 
<?php endif;?> 
+1

因爲你有兩個endforeach; – mattacular

回答

2

那麼有一個開口foreach而是兩個關閉endforeach

1

我建議您將<? if([...] ?>編輯爲<?php if([...] ?>。我不太確定這是否能解決您的所有問題,但<?在較新的php版本中無效。

0

您是否打開短打開標籤?如果沒有,你的第一個if需要一個完整的<?php

<? if ($aItem['position'] == "Gardien"): ?>