2011-08-10 10 views
1

もし私が幸せになれば、私は本当に構文が正しいと確信しています。 行36はエラーをスローします。これが最初のelseです。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

を必要とします。 – mattacular

答えて

2

まあ一つの開口foreachが、2つのendforeachを閉じるがあります。

1

<? if([...] ?><?php if([...] ?>に編集することをおすすめします。私はそれがあなたの問題のすべてを解決するかどうかは分かりませんが、<?は新しいPHPリリースでは無効です。

0

短い公開タグを有効にしていますか?ない場合は、2 endforeachを持っている原因、あなたの最初のifはフル<?php

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