неожиданный T_ELSE в шаблоне html / php - PullRequest
1 голос
/ 10 августа 2011

Если вы сможете найти его, я буду счастлив, хотя я почти уверен, что синтаксис правильный.В строке 36 выдается ошибка, которая является первой.

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;?>

Ответы [ 3 ]

2 голосов
/ 10 августа 2011

Ну, есть одно открытие foreach, но два закрытия endforeach.

1 голос
/ 10 августа 2011

Я бы порекомендовал вам отредактировать <? if([...] ?> в <?php if([...] ?>. Я не слишком уверен, решит ли это все ваши проблемы, но <? недействителен в новых версиях php.

0 голосов
/ 10 августа 2011

У вас включены короткие открытые теги?Если нет, ваш первый if нуждается в полном <?php

<? if ($aItem['position'] == "Gardien"): ?>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...