【发布时间】:2014-11-21 03:21:42
【问题描述】:
这段 sn-p 代码似乎一直在 Apache 中运行,但是当切换到 NGINX 时,我收到 500 内部服务器错误。在我的 nginx 日志中,我得到了
PHP 消息:PHP 解析错误:语法错误,/var/public_html/app/design/frontend//template/seorich/review/summary.phtml 中的意外 'elseif' (T_ELSEIF) 在第 51 行“读取响应标头从上游,
它引用了这段代码
<?php elseif ($this->getDisplayIfEmpty()): ?>
<p class="no-rating"><a href="<?php echo $this->getReviewsUrl() ?>#review-form"><?php echo $this- >__('Be the first to review this product') ?></a></p>
<?php endif; ?>
这是整个成功页面
<?php
/**
* @author Robogento <support@robogento.com>
* @package Robogento
* @subpackage SEO Rich
* @url http://robogento.com
*
* This code is protected by copyright and you are not allowed to share it, alter it and sell as your own.
* @copyright Copyright (c) 2012 Robogento
*/
?>
<?php if ($this->getReviewsCount()): ?>
<div class="ratings">
<?php if ($this->getRatingSummary()):?>
<div class="rating-box">
<div class="rating" style="width:<?php echo $this->getRatingSummary() ?>%"></div>
</div>
<?php endif;?>
<p class="rating-links">
<!--review property for google rich snippets start-->
<?php if($this->helper('seorich')->isEnabledAttr("review")):?><!--Check if rich snippet enabled for image-->
<span itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
(<span itemprop="ratingValue"><?php echo sprintf ("%.1f",($this->getRatingSummary()/100)*5);?></span> out of <span itemprop="bestRating">5</span>)
<a href="<?php echo $this->getReviewsUrl() ?>">
<span itemprop="reviewCount"><?=$this->getReviewsCount()?></span>
<?php echo $this->__('Review(s)') ?>
</a>
</span>
<?php else: ?>
<a href="<?php echo $this->getReviewsUrl() ?>">
<?=$this->getReviewsCount()?>
<?php echo $this->__('Review(s)') ?>
</a>
<?php endif; ?>
<!--review property for google rich snippets end-->
<span class="separator">|</span>
<a href="<?php echo $this->getReviewsUrl() ?>#review-form"><?php echo $this->__('Add Your Review') ?></a>
</p>
</div>
<?php elseif ($this->getDisplayIfEmpty()): ?>
<p class="no-rating"><a href="<?php echo $this->getReviewsUrl() ?>#review-form"><?php echo $this->__('Be the first to review this product') ?></a></p>
<?php endif; ?>
【问题讨论】:
-
if在哪里?您的第二个代码块与您的问题有什么关系? -
这是 elseif 之前的代码 - 导致它进入它
-
请粘贴
/var/public_html/app/design/frontend//template/seorich/review/summary.phtml的全部内容 -
为清楚起见添加了整页