Two column image layout

8 posts by 2 authors in: Forums > CMS Builder
Last Post: May 3, 2011   (RSS)

By Ginslinger - May 2, 2011

Need some help getting the layout below to work correctly.

<table width="100%">
<tr>
<td colspan="2" width="320">1st Image 320 pixels wide</td>
</tr>
<tr>
<td width="160">image160 wide</td>
<td width="160">Image 160 wide</td>
</tr>
<tr>
<td width="160">image160 wide</td>
<td width="160">Image 160 wide</td>
</tr>
</table>

Here is the viewer code.

<?php foreach ($articlesRecord['photos'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>

Re: [Ginslinger] Two column image layout

By gkornbluth - May 2, 2011

Hi Ginslinger,

What is it you would like the layout to do?

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Two column image layout

By Ginslinger - May 2, 2011

Just a simple image viewer with Lightbox. I can get the two column working but not sure that is right as I get a blank space.

As shown the very top image needs to be larger (320) and then smaller images display two wide below.

Re: [Ginslinger] Two column image layout

By gkornbluth - May 2, 2011

could you post the actual code that you're using in the viewer including the lightbox code?

Thanks,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Two column image layout

By Ginslinger - May 2, 2011

Code below is what I have on a test page. It displays two images wide but shows a blank image at the bottom. Also need to have a single image at the top that is 320 pixels wide.

<table border="1"> <tr> <?php foreach ($articlesRecord['photos'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<td>
<a href="<?php echo $upload['urlPath'] ?>" rel="lightbox[roadtrip]"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?> <img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>"
height="<?php echo $upload['thumbHeight'] ?>" alt="<?php echo $upload[info1] ?>" title="<?php echo $upload[info2] ?>"/> </a><br/>





</td>
<?php $maxCols=2; if (@++$count % $maxCols == 0): ?></tr>
<tr><?php endif; ?>
<?php elseif ($upload['isImage']): ?>
<td>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

<?php else: ?>
<td> <a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>
</td>
<?php endif ?>
<?php endforeach ?> <td>&nbsp;</td>
</tr>
</table>

Re: [gkornbluth] Two column image layout

By Ginslinger - May 3, 2011

Thanks for the help on this. I have the images loading in a two wide column with light box working OK.

What I need to do is have a single image load above the columns which is 320 pixels wide. Twice as wide as the lower images in columns.

Here is a test page with two columns working http://www.diecast-pub.com/model_list/gallery_test.php

Here is a link to an example of what I am trying to do. Note the larger image on top followed by two columns of images.

http://www.schmidtautocenter.com/listing.php?Dodge-173

Below is the current code being used for the two columns.

<b>Click for a larger view!
</b>
<table border="1"><tr> <td colspan="2">Image 320 Pixel wide here</td></tr>
<tr> <?php foreach ($articlesRecord['photos'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>


<td>
<a href="<?php echo $upload['urlPath'] ?>" rel="lightbox[roadtrip]"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?> <img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>"
height="<?php echo $upload['thumbHeight'] ?>" alt="<?php echo $upload[info1] ?>" title="<?php echo $upload[info2] ?>"/> </a><br/>


</td>
<?php $maxCols=2; if (@++$count % $maxCols == 0): ?></tr>
<tr><?php endif; ?>
<?php elseif ($upload['isImage']): ?>

<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>


<?php endif ?>
<?php endforeach ?>
</tr>
</table>

Re: [Ginslinger] Two column image layout

By gkornbluth - May 3, 2011

Just thinking out loud...

In the Schmidt example they're using an all CSS format.

However, looking at the Schmidt source code, they're using a different (larger) thumbnail for the image in the top box.

You can set up 2 thumbnails as well. The first thumbnail as 160px wide and thumbnail2 as 320px wide.

In your viewer, you might accomplish your goal by using a <?PHP break ?> to only show the first image and then display it as thumbnail2 in the top row (span 2 columns) instead of the smaller thumbnail.

For the others, you might use an "if' statement to begin looping through all images greater than image "0" (the first image) and display those using the smaller thumbnail.

Hope that helps

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php