Difference between revisions of "How to display image gallery below main listing image"

From JReviews Documentation
Jump to: navigation, search
Line 15: Line 15:
 
Find the code for main listing image:
 
Find the code for main listing image:
 
<source lang="php">
 
<source lang="php">
<?php if((!empty($listing['Listing']['images']) || $this->Config->content_default_image) && $enableIntroImage && $introImage = $Thumbnail->lightbox($listing,0,array('tn_mode'=>$introThumbnailMode,'dimensions'=>array($introThumbnailSize),'id'=>'thumb'.$listing['Listing']['listing_id']))):?>
+
<?php if((!empty($listing['Listing']['images']) || $this->Config->content_default_image) && $enableIntroImage && $introImage):?>
 
     <!-- MAIN IMAGE -->
 
     <!-- MAIN IMAGE -->
 
     <div class="itemMainImage" style="width:<?php echo $introThumbnailSize;?>px;"><?php echo $introImage;?></div>
 
     <div class="itemMainImage" style="width:<?php echo $introThumbnailSize;?>px;"><?php echo $introImage;?></div>
Line 24: Line 24:
 
replace it with this code which includes image gallery also:
 
replace it with this code which includes image gallery also:
 
<source lang="php">
 
<source lang="php">
<?php if((!empty($listing['Listing']['images']) || $this->Config->content_default_image) && $enableIntroImage && $introImage = $Thumbnail->lightbox($listing,0,array('tn_mode'=>$introThumbnailMode,'dimensions'=>array($introThumbnailSize),'id'=>'thumb'.$listing['Listing']['listing_id']))):?>
+
<?php if((!empty($listing['Listing']['images']) || $this->Config->content_default_image) && $enableIntroImage && $introImage):?>
     <div class="itemImages" style="width:<?php echo $introThumbnailSize+4;?>px;">
+
     <!-- MAIN IMAGE -->
        <!-- MAIN IMAGE -->
+
    <div class="itemMainImage" style="width:<?php echo $introThumbnailSize;?>px;"><?php echo $introImage;?></div>
        <div class="itemMainImage" style="width:<?php echo $introThumbnailSize;?>px;"><?php echo $introImage;?></div>
+
     <!-- IMAGE GALLERY -->
      
+
    <?php if(($enableGallery && (($enableIntroImage && $imageCount > 1) || (!$enableIntroImage && $imageCount >= 1)))):?>
        <!-- IMAGE GALLERY -->      
+
        <div class="itemThumbnails clearfix">
        <?php if(($enableGallery && (($enableIntroImage && $imageCount > 1) || (!$enableIntroImage && $imageCount >= 1)))):?>
+
        <?php for($i=(int)$enableIntroImage;$i<$imageCount;$i++):?>
            <div class="itemThumbs">
+
            <div><?php echo $Thumbnail->lightbox($listing,$i,array('tn_mode'=>$galleryThumbnailMode,'dimensions'=>array($galleryThumbnailSize)));?></div>
            <?php for($i=(int)$enableIntroImage;$i<$imageCount;$i++):?>
+
        <?php endfor;?>
                <div><?php echo $Thumbnail->lightbox($listing,$i,array('tn_mode'=>$galleryThumbnailMode,'dimensions'=>array($galleryThumbnailSize)));?></div>
+
        </div>
            <?php endfor;?>  
+
    <?php endif;?>
            </div>
+
<?php endif;?>
        <?php endif;?>
+
    </div>
+
<?php endif;?>
+
 
</source>
 
</source>
  
Line 44: Line 41:
 
and delete the old code for the gallery:
 
and delete the old code for the gallery:
 
<source lang="php">
 
<source lang="php">
<!-- IMAGE GALLERY -->      
+
<!-- IMAGE GALLERY -->
 
<?php if(($enableGallery && (($enableIntroImage && $imageCount > 1) || (!$enableIntroImage && $imageCount >= 1)))):?>
 
<?php if(($enableGallery && (($enableIntroImage && $imageCount > 1) || (!$enableIntroImage && $imageCount >= 1)))):?>
    <div class="clear"></div>
+
    <div class="clear"></div>
    <h3 class="jrHeading">
+
    <h3 class="jrHeading">
        <span class="jrIcon jrIconGallery"></span>
+
        <span class="jrIcon jrIconGallery"></span>
        <span class="jrHeadingText"><?php __t("Image Gallery");?></span>
+
        <span class="jrHeadingText"><?php __t("Image Gallery");?></span>
    </h3>
+
    </h3>
    <div class="itemThumbnails clearfix">
+
    <div class="itemThumbnails clearfix">
    <?php for($i=(int)$enableIntroImage;$i<$imageCount;$i++):?>
+
    <?php for($i=(int)$enableIntroImage;$i<$imageCount;$i++):?>
        <div><?php echo $Thumbnail->lightbox($listing,$i,array('tn_mode'=>$galleryThumbnailMode,'dimensions'=>array($galleryThumbnailSize)));?></div>
+
        <div><?php echo $Thumbnail->lightbox($listing,$i,array('tn_mode'=>$galleryThumbnailMode,'dimensions'=>array($galleryThumbnailSize)));?></div>
    <?php endfor;?>  
+
    <?php endfor;?>
    </div>
+
    </div>
 
<?php endif;?>
 
<?php endif;?>
 
</source>
 
</source>

Revision as of 11:21, 19 July 2012

By default, the image gallery displays separately below listing description, for example:

ImageGallery.png


If you want to display the gallery below main listing image like this:

ImageGallery2.png


you will need to modify this file:

  • /com_jreviews/jreviews/views/themes/{your_theme}/listings/detail.thtml


Find the code for main listing image:

<?php if((!empty($listing['Listing']['images']) || $this->Config->content_default_image) && $enableIntroImage && $introImage):?>
    <!-- MAIN IMAGE -->
    <div class="itemMainImage" style="width:<?php echo $introThumbnailSize;?>px;"><?php echo $introImage;?></div>
<?php endif;?>


replace it with this code which includes image gallery also:

<?php if((!empty($listing['Listing']['images']) || $this->Config->content_default_image) && $enableIntroImage && $introImage):?>
    <!-- MAIN IMAGE -->
    <div class="itemMainImage" style="width:<?php echo $introThumbnailSize;?>px;"><?php echo $introImage;?></div>
    <!-- IMAGE GALLERY -->
    <?php if(($enableGallery && (($enableIntroImage && $imageCount > 1) || (!$enableIntroImage && $imageCount >= 1)))):?>
        <div class="itemThumbnails clearfix">
        <?php for($i=(int)$enableIntroImage;$i<$imageCount;$i++):?>
             <div><?php echo $Thumbnail->lightbox($listing,$i,array('tn_mode'=>$galleryThumbnailMode,'dimensions'=>array($galleryThumbnailSize)));?></div>
         <?php endfor;?>
         </div>
     <?php endif;?>
 <?php endif;?>


and delete the old code for the gallery:

<!-- IMAGE GALLERY -->
<?php if(($enableGallery && (($enableIntroImage && $imageCount > 1) || (!$enableIntroImage && $imageCount >= 1)))):?>
     <div class="clear"></div>
     <h3 class="jrHeading">
         <span class="jrIcon jrIconGallery"></span>
         <span class="jrHeadingText"><?php __t("Image Gallery");?></span>
     </h3>
     <div class="itemThumbnails clearfix">
     <?php for($i=(int)$enableIntroImage;$i<$imageCount;$i++):?>
         <div><?php echo $Thumbnail->lightbox($listing,$i,array('tn_mode'=>$galleryThumbnailMode,'dimensions'=>array($galleryThumbnailSize)));?></div>
     <?php endfor;?>
     </div>
<?php endif;?>


These changes will also require new css styles. Paste the below code into custom_styles.css in your theme:

div.itemImages {
    float: right;
    margin: 0 0 30px 10px;
    text-align: center;
}
div.itemImages div.itemMainImage {
    margin: 0 0 10px 0;
    overflow: hidden;
    clear: both;
}
div.itemImages div.itemThumbs {
    clear: both;
}
div.itemImages div.itemThumbs div {
    border: 1px solid #ccc;
    float: left;
    margin: 0 5px 7px 0;
    overflow: hidden;
    padding: 1px;
    text-align: center;
    vertical-align: middle;
}