2 Columns to display my articles
2 posts by 2 authors in: Forums > CMS Builder
Last Post: July 17, 2012 (RSS)
By Jesus - July 17, 2012 - edited: July 17, 2012
Hello,
Back on AM2 I used to had 2 columns (articleList template) in order to display my articles (10 per page) using this code:
Is it possible to convert this code to work with CMS?
Thanks!
Back on AM2 I used to had 2 columns (articleList template) in order to display my articles (10 per page) using this code:
<table border="0" cellspacing="2" cellpadding="1">
<tr>
<!-- template insert : $articleList$ -->
<!-- templatecell : articleRow -->
<td valign="top" width="50%" class="text_place">
<!-- templateIf : $article.externalLink$ eq "" -->
<a href="$published.articlePage.url$" class="biglink" title="$article.title$"><h3>$article.title$</h3></a>
<a href="$published.articlePage.url$" class="biglinkblack" title="$article.PromoTitle$">$article.PromoTitle$</a>
<p>$article.summary$ <a href="$published.articlePage.url$" class="green" title="Presione aqui para ingresar ">Presione aqui para ingresar</a></p>
<!-- /templateIf -->
<!-- templateIf : $article.externalLink$ ne "" -->
<a href="$article.externalLink$" class="biglink" title="$article.title$"><h3>$article.title$</h3></a>
<a href="$article.externalLink$" class="biglinkblack" title="$article.PromoTitle$">$article.PromoTitle$</a>
<p>$article.summary$ <a href="$article.externalLink$" class="green" title="Presione aqui para ingresar ">Presione aqui para ingresar</a></p>
<!-- /templateIf -->
</td>
<!-- templateIf: $articleList.currentResultCounter$ isMultipleOf "2" --></tr><tr><td colspan="2"class="mr_clear_brd" width="100%"> </td></tr><tr><!-- /templateIf -->
<!-- /templatecell : articleRow -->
</tr>
</table>
Is it possible to convert this code to work with CMS?
Thanks!
Re: [Jesus] 2 Columns to display my articles
By gkornbluth - July 17, 2012
Hi Jesus,
Here's a recipe from my CMSB Cookbook, thecmsbcookbook.com for using as multi-column technique for an image display, but you can easily modify it to show any content (your articles).
Hope it helps,
Jerry Kornbluth
LIMITING THE AMOUNT OF COLUMNS IN A SINGLE ROW IMAGE DISPLAY
Here’s a suggestion from Interactive Tools’ Dave Edis:
The CSS way is to have each image in a div that has something like: style="float: left; width: 200px". This will make them flow from left to right and wrap when they run out of space (you can put them inside a bigger fixed width container).
Or with a table you can have one table cell per image and insert a closing and opening TR every X images. Here's a code snippet that does that:
Which is just a way of saying "Every 2 images insert "</tr><tr>"".
Here’s a single row example using the thumbnail2 image as a link to a detail page, separate Title and Subtitle fields, a hidden border for IE and a fixed height for the image cell so that everything lines up nicely.
Use your own variable names instead of $yourrecord, but the inserted code can stay the same.
Here's a recipe from my CMSB Cookbook, thecmsbcookbook.com for using as multi-column technique for an image display, but you can easily modify it to show any content (your articles).
Hope it helps,
Jerry Kornbluth
LIMITING THE AMOUNT OF COLUMNS IN A SINGLE ROW IMAGE DISPLAY
Here’s a suggestion from Interactive Tools’ Dave Edis:
The CSS way is to have each image in a div that has something like: style="float: left; width: 200px". This will make them flow from left to right and wrap when they run out of space (you can put them inside a bigger fixed width container).
Or with a table you can have one table cell per image and insert a closing and opening TR every X images. Here's a code snippet that does that:
<?php $maxCols=2; if (@++$count % $maxCols == 0): ?></tr><tr><?php endif; ?>
Which is just a way of saying "Every 2 images insert "</tr><tr>"".
Here’s a single row example using the thumbnail2 image as a link to a detail page, separate Title and Subtitle fields, a hidden border for IE and a fixed height for the image cell so that everything lines up nicely.
<table width="100%" border="0" cellpadding="5">
<tr>
<?php foreach ($your_sectionRecords as $record): ?><?php foreach ($record['image'] as $upload): ?>
<td align=”center” height="350" valign="bottom">
<a href="<?php echo $record['_link'] ?>"><img src="<?php echo $upload['thumbUrlPath2'] ?>" width="<?php echo $upload['thumbWidth2'] ?>" height="<?php echo $upload['thumbHeight2'] ?>" alt="" style="border:hidden" /><br /><div align="center" class="medium-title"><?php echo $record['title'] ?></div>
<div align="center" class="medium-text"><?php echo $record['sub_title'] ?></div></a>
</td>
<?php $maxCols=2; if (@++$count % $maxCols == 0): ?></tr><tr><?php endif; ?>
<?php endforeach ?><?php endforeach ?>
</tr>
</table>
Similarly, if you’re not using images this code will output a </tr><tr> after every 2 <td>...your content...</td> lines:
<table border="1">
<tr>
<?PHP foreach ($yourrecords as $record): ?>
<td>
<?PHP echo $record['your_content'] ?><br />
</td>
<?PHP $maxCols=2; if (@++$count % $maxCols == 0): ?></tr><tr><?PHP endif; ?>
<?PHP endforeach; ?>
</tr>
</table>
Use your own variable names instead of $yourrecord, but the inserted code can stay the same.
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
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php