2016-09-22 74 views
0

我想要做的是添加一个elevatezoom画廊,并根据他们从mysql得到的结果创建这些小方块(如果photo1设置为任何位置,然后square1出现,如果photo2设置为位置,方块2出现,如果照片3是空的,没有出现(你的想法)空白页面诊断。如果问题

问题是,接下来的编辑后,我得到一个空白页。

这是整个代码。

<?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> 
+0

画廊&灯箱’检查你的日志 – aynber

回答

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

在您的脚本开发的顶部。

0

修复了问题@Dave。我现在遇到接下来的事情是完全改变布局和elevatezoom JS错误:

 jquery.elevatezoom.js:39 
Uncaught TypeError: $(...).elevateZoom is not a function(anonymous function) @ jquery.elevatezoom.js:39 

线39+有关的一切是:

//initiate the plugin and pass the id of the div containing gallery images 
$(".zoom").elevateZoom({gallery:'gal1', cursor: 'pointer', galleryActiveClass: 'active', imageCrossfade: true, loadingIcon: 'http://www.elevateweb.co.uk/spinner.gif'}); 

//pass the images to Fancybox 
$(".zoom").bind("click", function(e) { 
    var ez = $('.zoom').data('elevateZoom');  
    $.fancybox(ez.getGalleryList()); 
    return false; 
}); 

我缺少什么呢?

的CSS线以及:

/*set a border on the images to prevent shifting*/ 
#zoom img{border:2px solid white;} 

/*Change the colour*/ 
.active img{border:2px solid #333 !important;} 

在主PHP文件的单一变化是 'isset' 到”空! =='

我也从如下的说明‘从http://www.elevateweb.co.uk/image-zoom/examples