Display 1 record from mutliple lists in order by date

7 posts by 3 authors in: Forums > CMS Builder
Last Post: August 24, 2010   (RSS)

By s2smedia - August 24, 2010

I have a tab on my page that shows the most recent News, Events, Media

I would like it to show the first most recent record from each list.. but have it in order by date..

Re: [s2smedia] Display 1 record from mutliple lists in order by date

By Jason - August 24, 2010

Hi,

So, if I understand correctly, you want to display the most recent record for news, events, and media. Only 1 record per section. But then display those 3 records, ordered by date. Is that right?

If so, take a look at this post. I think this will get you started.
http://www.interactivetools.com/forum/gforum.cgi?post=82652#82652

Let me know if you run into any issues.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Display 1 record from mutliple lists in order by date

By s2smedia - August 24, 2010

hmm.. not sure if thats working..

http://clubambassadors.org/pages/index.php?club_name=CASL&&createdByUserNum=3


CODE:

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php


// load viewer library
$libraryPath = 'login/lib/viewer_functions.php';
$dirsToCheck = array('XXX');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load records
list($eventsRecords, $eventsMetaData) = getRecords(array(
'tableName' => 'events',
'perPage' => '4',
));

?>
<?php


// load viewer library
$libraryPath = 'login/lib/viewer_functions.php';
$dirsToCheck = array('XXX');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load records
list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'perPage' => '4',
));

?>
<?php


// load viewer library
$libraryPath = 'login/lib/viewer_functions.php';
$dirsToCheck = array('XXX');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load records
list($banner_managerRecords, $banner_managerMetaData) = getRecords(array(
'tableName' => 'banner_manager',
'limit' => '2',
'orderBy' => 'RAND()',
));

?>
<?php


// load viewer library
$libraryPath = 'login/lib/viewer_functions.php';
$dirsToCheck = array('XXX');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load records
list($accountsRecords, $accountsMetaData) = getRecords(array(
'tableName' => 'accounts',
'limit' => '1',
));
$accountsRecord = @$accountsRecords[0]; // get first record

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php echo $accountsRecord['club_name'] ?> | Club Ambassadors</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
<link href="css/smoothcalendar.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="as/popupwindow.as"></script>
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<script type="text/javascript" src="js/mootools-1.2.1-core-nc.js"></script>
<script type="text/javascript" src="js/smoothcalendar.js"></script>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<script type="text/javascript">

window.addEvent('domready', function(){
var date = new Date("<?php print(Date("l F d, Y")); ?>");
var smoothCalendar = new SmoothCalendar("calendar", date);
});

</script>

<style type="text/css">
#calendar {
width:373px;
margin: 0px auto;
}
</style>
<style type="text/css">
.day_content_with_event {
background-color: <?php echo $accountsRecord['color_1'] ?>;
cursor : pointer;

z-index: 500;
display: block;
overflow: hidden;
}
.smoothcalendar_listItem_mouseover {
cursor : pointer;
padding : 5px 5px;
margin-bottom : 2px;
background-color : #333;
color : <?php echo $accountsRecord['color_1'] ?>;
}

.day_content_with_event_mouseover {
background-color: <?php echo $accountsRecord['color_1'] ?>;
border : 2px solid <?php echo $accountsRecord['color_2'] ?>;
cursor : pointer;

}
.smoothcalendar #fullDateText {
text-transform: uppercase;
margin-bottom: 20px;
font-size: 140%;
color : <?php echo $accountsRecord['color_1'] ?>;
}
.current_date {
font-size: 10pt;
font-weight: bold;
line-height: 2.3em;
color : <?php echo $accountsRecord['color_1'] ?>;
}
</style>
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body onload="MM_preloadImages('images/menu_ov_r1_c6.gif','images/menu_dwn_r1_c1.gif','images/menu_dwn_r1_c2.gif','images/menu_dwn_r1_c3.gif')">
<table width="922" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td colspan="2" align="right" valign="top" style="padding:5px 0px 5px 0px" id="login">Welcome Back [First Name]! <a href="#" style="color:<?php echo $accountsRecord['color_1'] ?>">My Account</a> | <a href="#" style="color:<?php echo $accountsRecord['color_1'] ?>">Log Out</a></td>
</tr>
<tr>
<td colspan="2"><table width="922" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4"><img src="images/header_r1_c1.gif" width="922" height="18" /></td>
</tr>
<tr>
<td width="2" align="left" valign="top" style="background-image:url(images/header_r2_c1.gif); background-repeat:repeat-y"><img src="images/header_r2_c1.gif" width="2" height="71" /></td>
<td width="203" align="left" valign="middle" style="background-image:url(images/header_r2_c3.gif); background-repeat:repeat-x; background-color:#F7F5F6; padding:0px 10px 0px 20px">
<?php foreach ($accountsRecord['logo'] as $upload): ?>
<a href="index.php?num=<?php echo $accountsRecord['num'] ?>"><img src="http://www.clubambassadors.org/<?php echo $upload['urlPath'] ?>" alt="<?php echo $accountsRecord['club_name'] ?>" width="205" border="0" /></a>
<?php endforeach ?>
</td>
<td width="715" align="center" valign="middle" style="background-image:url(images/header_r2_c3.gif); background-repeat:repeat-x; background-color:#F7F5F6"><?php include("includes/menu.php"); ?></td>
<td width="2" align="left" valign="top" style="background-image:url(images/header_r2_c5.gif); background-repeat:repeat-y"><img src="images/header_r2_c5.gif" width="2" height="71" /></td>
</tr>
<tr>
<td colspan="4"><img src="images/header_r3_c1.gif" width="922" height="19" /></td>
</tr>
</table></td>
</tr>

<tr>
<td width="260" align="left" valign="top" style="padding:5px 0px 0px 0px"><a href="<?php echo $accountsRecord['payment_gateway_link'] ?>" target="_blank"><img src="images/makepayment.gif" alt="Make A Payment" width="254" height="92" border="0" /></a></td>
<td width="662" align="right" valign="top" style="padding:5px 0px 0px 0px"><?php foreach ($banner_managerRecords as $record): ?>
<?php foreach ($record['banner_upload'] as $upload): ?>
<?php if ($record['banner_type'] != 'Header Banner (662 x 92)') { continue; } ?>
<a href="<?php echo $record['banner_link'] ?>" target="_blank"><img src="<?php echo $upload['urlPath'] ?>" alt="<?php echo $record['banner_name'] ?>" width="662" height="92" border="0" /></a
><?php endforeach ?>

<?php endforeach ?></td>
</tr>
<tr>
<td width="260" align="left" valign="top" colspan="2" style="padding:5px 0px 0px 0px"><object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="922" height="28">
<param name="movie" value="newsTicker.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="swfversion" value="9.0.45.0" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="newsTicker.swf" width="922" height="28">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="swfversion" value="9.0.45.0" />
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object></td>

</tr>
<tr>
<td colspan="2" align="left" valign="top"><table width="922" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="500" height="500" rowspan="3" align="left" valign="top" style="padding:5px 8px 8px 0px">
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup">
<li id="t1" class="TabbedPanelsTab1" tabindex="0"><img src="images/blank.gif" width="116" height="33" /></li>
<li id="t2" class="TabbedPanelsTab2" tabindex="0"><img src="images/blank.gif" width="75" height="33" /></li>
<li id="t3" class="TabbedPanelsTab3" tabindex="0"><img src="images/blank.gif" width="85" height="33" /></li>
<li id="t4" class="TabbedPanelsTab4" tabindex="0"><img src="images/blank.gif" width="121" height="33" /></li>
<li id="t5" class="TabbedPanelsTab5" tabindex="0"><img src="images/blank.gif" width="122" height="33" /></li>
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent">
<div id="filterbar">Filter by Teams:
<label>
<select name="select" id="select">
<option value="Select One" selected="selected">Select One</option>
<?php $options = getListLabels('accounts', 'teams', $accountsRecord['teams']) ?>
<?php foreach($options as $option): ?>

<?php endforeach ?>

</select>
</label>
</div>
<?php foreach ($newsRecords as $record): ?>
<div id="feedbox"><b style="font-size:16px; color:<?php echo $accountsRecord['color_2'] ?>; font-style:italic"><?php echo date("n.j.y", strtotime($record['date'])) ?></b>
<div style="color:<?php echo $accountsRecord['color_1'] ?>; font-size:20px; font-weight:bold; padding:0px 0px 5px 0px"><?php echo $record['title'] ?></div>
<div style="line-height:17px; height:110px; padding:0px 0px 10px 0px"><?php foreach ($record['file_upload'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" alt="" height="110" align="left" style="border:medium; border-color:#<?php echo $accountsRecord['color_1'] ?>" />

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

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>"><b style="font-size:12px; color:<?php echo $accountsRecord['color_2'] ?>; font-style:italic">View File</b> <?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>
<?php echo $record['content'] ?>
<a href="<?php echo $record['_link'] ?>" style="color:<?php echo $accountsRecord['color_1'] ?>; font-size:10px">Click Here</a></div>
<div id="tagfooter">Tagged: <?php echo join(', ', getListLabels('news', 'tag', $record['tag'])); ?></div>
</div>
<?php endforeach ?>

<?php if ($newsMetaData['invalidPageNum']): ?>
Results page '<?php echo $newsMetaData['page']?>' not found, <a href="<?php echo $newsMetaData['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
<?php elseif (!$newsRecords): ?>
No records were found!<br/><br/>
<?php endif ?>

</div>
<!---->
<div class="TabbedPanelsContent"><div id="filterbar">Filter by Teams:
<label>
<select name="select" id="select">
<option value="Select One" selected="selected">Select One</option>
<?php $options = getListLabels('accounts', 'teams', $accountsRecord['teams']) ?>
<?php foreach($options as $option): ?>

<?php endforeach ?>

</select>
</label>
</div>
<?php foreach ($newsRecords as $record): ?>
<div id="feedbox"><b style="font-size:16px; color:<?php echo $accountsRecord['color_2'] ?>; font-style:italic"><?php echo date("n.j.y", strtotime($record['date'])) ?></b>
<div style="color:<?php echo $accountsRecord['color_1'] ?>; font-size:20px; font-weight:bold; padding:0px 0px 5px 0px"><?php echo $record['title'] ?></div>
<div style="line-height:17px; height:110px; padding:0px 0px 10px 0px"><?php foreach ($record['file_upload'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" alt="" height="110" align="left" style="border:medium; border-color:#<?php echo $accountsRecord['color_1'] ?>" />

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

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>"><b style="font-size:12px; color:<?php echo $accountsRecord['color_2'] ?>; font-style:italic">View File</b> <?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>
<?php echo $record['content'] ?>
<a href="<?php echo $record['_link'] ?>" style="color:<?php echo $accountsRecord['color_1'] ?>; font-size:10px">Click Here</a></div>
<div id="tagfooter">Tagged: <?php echo join(', ', getListLabels('news', 'tag', $record['tag'])); ?></div>
</div>
<?php endforeach ?>

<?php if ($newsMetaData['invalidPageNum']): ?>
Results page '<?php echo $newsMetaData['page']?>' not found, <a href="<?php echo $newsMetaData['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
<?php elseif (!$newsRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
</div>
<!---->
<div class="TabbedPanelsContent"><div id="filterbar">Filter by Teams:
<label>
<select name="select" id="select">
<option value="Select One" selected="selected">Select One</option>
<option value="Marketing">Marketing</option>
<option value="Fundraising">Fundraising</option>
<option value="Program">Program</option>
<option value="Travel">Travel</option>
<option value="Corporate">Corporate</option>
</select>
</label>
</div>
<?php foreach ($eventsRecords as $record): ?>
<div id="feedbox"><b style="font-size:16px; color:<?php echo $accountsRecord['color_2'] ?>; font-style:italic"><?php echo date("n.j.y", strtotime($record['date'])) ?></b>
<div style="color:<?php echo $accountsRecord['color_1'] ?>; font-size:20px; font-weight:bold; padding:0px 0px 5px 0px"><?php echo $record['title'] ?></div>
<div style="line-height:17px; height:110px; padding:0px 0px 10px 0px">
<?php echo $record['content'] ?>
<a href="<?php echo $record['_link'] ?>" style="color:<?php echo $accountsRecord['color_1'] ?>; font-size:10px">Click Here</a></div>
<div id="tagfooter">Tagged: <?php echo join(', ', getListLabels('news', 'tag', $record['tag'])); ?></div>
</div>
<?php endforeach ?>

<?php if ($eventsMetaData['invalidPageNum']): ?>
Results page '<?php echo $eventsMetaData['page']?>' not found, <a href="<?php echo $newsMetaData['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
<?php elseif (!$eventsRecords): ?>
No records were found!<br/><br/>
<?php endif ?></div>
<!---->
<div class="TabbedPanelsContent">
<div id="filterbar">Filter by Teams:
<label>
<select name="select" id="select">
<option value="Select One" selected="selected">Select One</option>
<?php $options = getListLabels('accounts', 'teams', $accountsRecord['teams']) ?>
<?php foreach($options as $option): ?>

<?php endforeach ?>

</select>
</label>
</div>
<?php foreach ($newsRecords as $record): ?>
<div id="feedbox"><b style="font-size:16px; color:<?php echo $accountsRecord['color_2'] ?>; font-style:italic">8.20.10</b>
<div style="color:<?php echo $accountsRecord['color_1'] ?>; font-size:20px; font-weight:bold; padding:0px 0px 5px 0px">HEADLINE</div>
<div style="line-height:17px; height:110px; padding:0px 0px 10px 0px"><?php foreach ($record['file_upload'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" alt="" height="110" align="left" style="border:medium; border-color:#<?php echo $accountsRecord['color_1'] ?>" />

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

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>"><b style="font-size:16px; color:<?php echo $accountsRecord['color_2'] ?>; font-style:italic">View File</b><?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>
<?php echo $record['content'] ?>
<a href="<?php echo $record['_link'] ?>" style="color:<?php echo $accountsRecord['color_1'] ?>; font-size:10px">Click Here</a></div>
<div id="tagfooter">Tagged: <?php echo join(', ', getListLabels('news', 'tag', $record['tag'])); ?></div>
</div>
<?php endforeach ?>

<?php if ($newsMetaData['invalidPageNum']): ?>
Results page '<?php echo $newsMetaData['page']?>' not found, <a href="<?php echo $newsMetaData['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
<?php elseif (!$newsRecords): ?>
No records were found!<br/><br/>
<?php endif ?></div>
<!---->
<div class="TabbedPanelsContent">
<div id="filterbar">Filter by Teams:
<label>
<select name="select" id="select">
<option value="Select One" selected="selected">Select One</option>
<?php $options = getListLabels('accounts', 'teams', $accountsRecord['teams']) ?>
<?php foreach($options as $option): ?>

<?php endforeach ?>

</select>
</label>
</div>
<?php foreach ($newsRecords as $record): ?>
<div id="feedbox"><b style="font-size:16px; color:<?php echo $accountsRecord['color_2'] ?>; font-style:italic">8.20.10</b>
<div style="color:<?php echo $accountsRecord['color_1'] ?>; font-size:20px; font-weight:bold; padding:0px 0px 5px 0px">HEADLINE</div>
<div style="line-height:17px; height:110px; padding:0px 0px 10px 0px"><?php foreach ($record['file_upload'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" alt="" height="110" align="left" style="border:medium; border-color:#<?php echo $accountsRecord['color_1'] ?>" />

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

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>"><b style="font-size:12px; color:<?php echo $accountsRecord['color_2'] ?>; font-style:italic">View File</b> <?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>
<?php echo $record['content'] ?>
<a href="<?php echo $record['_link'] ?>" style="color:<?php echo $accountsRecord['color_1'] ?>; font-size:10px">Click Here</a></div>
<div id="tagfooter">Tagged: <?php echo join(', ', getListLabels('news', 'tag', $record['tag'])); ?></div>
</div>
<?php endforeach ?>

<?php if ($newsMetaData['invalidPageNum']): ?>
Results page '<?php echo $newsMetaData['page']?>' not found, <a href="<?php echo $newsMetaData['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
<?php elseif (!$newsRecords): ?>
No records were found!<br/><br/>
<?php endif ?>

</div>
</div>
</div></td>
<td width="394" height="393" align="left" valign="top" style="padding:5px 0px 3px 0px"><table width="393" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" valign="top"><img src="images/calendar_header.gif" width="393" height="35" /></td>
</tr>
<tr>
<td height="350" align="left" valign="top" id="calendar2">
<div id="calendar">
<?php foreach ($eventsRecords as $record): ?>
<div class="<?php echo date("D, M j, Y g:i:s", strtotime($record['date'])) ?>" title="<?php echo $record['title'] ?>">
<?php echo $record['content'] ?><br /><br />
<?php echo join(' | ', getListLabels('events', 'tag', $record['tag'])); ?>
</div>
<?php endforeach ?>

</div>
<?php foreach ($eventsRecords as $record): ?>
<div style="margin:10px">
<div style="font-size:16px; color:<?php echo $accountsRecord['color_1'] ?>; font-style:italic"><?php echo date("n.j.y", strtotime($record['date'])) ?></div>
<div style="font-size:13px; color:#4C4446"><a href="<?php echo $record['_link'] ?>" style="color:<?php echo $accountsRecord['color_1'] ?>; text-decoration:underline"><?php echo $record['title'] ?></a></div>
</div>
<?php endforeach ?>

</td>
</tr>
</table></td>
</tr>
<tr>
<td align="left" valign="top"><a href="http://www.facebook.com/pages/Club-Ambassadors/287517719903?ref=search" target="_blank"><img src="images/img_r1_c1.jpg" alt="Become a Fan on Facebook!" width="198" height="100" border="0" /></a><a href="http://twitter.com/ClubAmbassadors" target="_blank"><img src="images/img_r1_c2.jpg" alt="Follow Us On Twitter!" width="196" height="100" border="0" /></a></td>
</tr>
<tr>
<td align="left" valign="top" style="padding:3px 0px 8px 0px">
<?php foreach ($banner_managerRecords as $record): ?>
<?php if ($record['banner_type'] != 'Side Banner (394 x 201)') { continue; } ?>
<?php foreach ($record['banner_upload'] as $upload): ?>
<a href="<?php echo $record['banner_link'] ?>" target="_blank"><img src="<?php echo $upload['urlPath'] ?>" alt="<?php echo $record['banner_name'] ?>" width="394" height="201" border="0" /></a
><?php endforeach ?>

<?php endforeach ?>
</td>
</tr>
</table></td>
</tr>
<?php include("includes/footer.php"); ?>
</table>
<script type="text/javascript">
<!--
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
swfobject.registerObject("FlashID");
//-->
</script>

</body>
</html>

Re: [s2smedia] Display 1 record from mutliple lists in order by date

By Jason - August 24, 2010

Hi,

I took a quick look at your code and I can't see any of the code from the other forum post:
http://www.interactivetools.com/forum/gforum.cgi?post=82652#82652

Try integrating that code in and let me know if you run into any difficulties.

If you'd like, we can do the integration for you through our consulting service. Just send an email to consulting@interactivetools.com and we can get you a quote.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Display 1 record from mutliple lists in order by date

By s2smedia - August 24, 2010

ok.. is there a way to just have it display 1 record..
but using the code in the body, not the code in the header..

ex.
<?php foreach ($eventsRecords as $record): ?>
<ONLY DISPLAY 1>
<div class="<?php echo date("D, M j, Y g:i:s", strtotime($record['date'])) ?>" title="<?php echo $record['title'] ?>">
<?php echo $record['content'] ?><br /><br />
<?php echo join(' | ', getListLabels('events', 'tag', $record['tag'])); ?>
</div>
<?php endforeach ?>

I can just do it this way untill i fugre the other way out

Re: [s2smedia] Display 1 record from mutliple lists in order by date

By Chris - August 24, 2010 - edited: August 24, 2010

Hi s2smedia,

Yes, you can insert a BREAK statement after displaying the first record and PHP will break out of the foreach, skipping the rest of the records:

<?php foreach ($eventsRecords as $record): ?>
<div class="<?php echo date("D, M j, Y g:i:s", strtotime($record['date'])) ?>" title="<?php echo $record['title'] ?>">
<?php echo $record['content'] ?><br /><br />
<?php echo join(' | ', getListLabels('events', 'tag', $record['tag'])); ?>
</div>
<?php break ?>
<?php endforeach ?>


I hope this helps!
All the best,
Chris