空白页面诊断。如果有问题

时间:2016-09-22 15:29:54

标签: php mysql if-statement elevatezoom

我要做的是添加一个Elevatezoom画廊并根据他们从mysql获得的结果创建那些小方块(如果photo1设置为任何位置,则square1出现,如果photo2设置为某个位置,方形2出现,如果photo3为空,则不会出现任何内容(您明白了)

问题是,在下一次编辑之后,我得到一个空白页面。

这是整个代码。

    <?php use_helper("StaticUrl");?>
<div class="product_image">
    <?php 
      $href = url_for($product->getRouteUrl(ESC_RAW));
      if ($sf_context->getActionName() == 'view')
    {
      $href = static_url_for($product->generatePhotoPath('large',ESC_RAW));
    }
    ?>

  <a <?php echo $sf_context->getActionName() == 'view' ? 'class="lightbox"' : ''; ?> href="<?php echo $href;?>" title="<?php echo $product; ?>">
        <img src="<?php echo  static_url_for($product->generatePhotoPath(ESC_RAW)); ?>" alt="<?php echo $product; ?>" data-zoom-image="<?php echo  static_url_for($product->generatePhotoPath('large',ESC_RAW)); ?>" class="zoom" style="z-index:999999;" />
  </a>

  <?php 
   $resultt  = Doctrine_Query::create()->from("Product")
                          ->select("photo1")
                          ->where("id = ?", $product_id)
                          ->fetchOne(array(), Doctrine_Core::HYDRATE_ARRAY);
    if (empty($resultt))
    {
       return sfView::NONE;
    }  

?>

    <?php if(isset(resultt)){  ?>
  <div id="gal1">

  <a href="#" data-image="<?php echo  url_for($product->generatePhotoPath("small", 1, ESC_RAW)); ?>" data-zoom-image="<?php echo  url_for($product->generatePhotoPath("large", 1, ESC_RAW)); ?>">
    <img id="img_01" src="<?php echo  url_for($product->generatePhotoPath("small", 1, ESC_RAW)); ?>" />
  </a>

    <?php } ?>

  <a href="#" data-image="<?php echo  url_for($product->generatePhotoPath("small", 2, ESC_RAW)); ?>" data-zoom-image="<?php echo  url_for($product->generatePhotoPath("large", 2, ESC_RAW)); ?>">
    <img id="img_01" src="<?php echo  url_for($product->generatePhotoPath("small", 2, ESC_RAW)); ?>" />
  </a>

  <a href="#" data-image="<?php echo  url_for($product->generatePhotoPath("small", 3, ESC_RAW)); ?>" data-zoom-image="<?php echo  url_for($product->generatePhotoPath("small", 3, ESC_RAW)); ?>">
    <img id="img_01" src="<?php echo  url_for($product->generatePhotoPath("small", 3, ESC_RAW)); ?>" />
  </a>

</div>
</div>

<script src="/js/elevatezoom/jquery.elevatezoom.js" type="text/javascript"></script>

1 个答案:

答案 0 :(得分:1)

您发布的内容第27行有错误:

if(isset(resultt)){

错误是:

Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead)

尝试查找错误时,有助于启用所有错误,因此会显示此类错误。使用

error_reporting (E_ALL);

在开发过程中位于脚本顶部。