2016-09-22 6 views
0

私がしようとしているのは、エレベータズームギャラリーを追加し、mysqlから得た結果に基づいてそれらの小さな四角形を作成することです(photo1が任意の場所に設定されている場合はsquare2が表示され、図2は、写真3が空の場合、何も表示されない、表示された問題は、次の編集後、私は空白のページを取得していますされ空白のページを診断します。 IF問題

(あなたのアイデアを得る)。

これは、全体のコードです。

<?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ファイル内の単一の変更がnull「から 'ISSET' です! ==あなたのログを確認してくださいhttp://www.elevateweb.co.uk/image-zoom/examples

関連する問題