<template:if $LEAD_IN>
##$LEAD_IN##
</template:if>
<template:snippet name="render_paging_list" />
<?php
$count = 0;
$newsStruct = array();
?>
<template:list>
<template:item>
<?php
$news = array();
$__t_assetManager = getStaticClass('AssetManager');
$__t_assets = $__t_assetManager->getAssetFromStructByUsage($item['assets'], 'thumbnail');
if (count($__t_assets)) {
$__t_assets[0]['href'] = $__t_assetManager->getPathFromStruct($__t_assets[0], 'web', $__t_assets[0]['primarySiteId'], $templateConstants['isPublishing'], $templateConstants['webRoot'], '100', '');
$__t_assets[0]['path'] = $__t_assetManager->getPathFromStruct($__t_assets[0], 'physical', $__t_assets[0]['primarySiteId'], isPublished(), null, '100', '');
$__t_assets[0]['fileSize'] = @filesize($__t_assets[0]['path']);
$__t_assets[0]['alternateHref'] = $__t_assetManager->getPathFromStruct($__t_assets[0], 'web', $__t_assets[0]['primarySiteId'], $templateConstants['isPublishing'], $templateConstants['webRoot'], '100', '', true);
$__t_assets[0]['alternatePath'] = $__t_assetManager->getPathFromStruct($__t_assets[0], 'physical', $__t_assets[0]['primarySiteId'], isPublished(), null, '100', '', true);
if (isset($__t_assets[0]['captionOverride']) && strlen($__t_assets[0]['captionOverride'])) $__t_assets[0]['caption'] = $__t_assets[0]['captionOverride'];
$news['thumb'] = $__t_assets[0];
}
else $news['thumb'] = false;
$__t_assetManager = getStaticClass('AssetManager');
$__t_assets = $__t_assetManager->getAssetFromStructByUsage($item['assets'], 'documentation');
if (count($__t_assets)) {
$__t_assets[0]['href'] = $__t_assetManager->getPathFromStruct($__t_assets[0], 'web', $__t_assets[0]['primarySiteId'], $templateConstants['isPublishing'], $templateConstants['webRoot'], '', '');
$__t_assets[0]['path'] = $__t_assetManager->getPathFromStruct($__t_assets[0], 'physical', $__t_assets[0]['primarySiteId'], isPublished(), null, '', '');
$__t_assets[0]['fileSize'] = @filesize($__t_assets[0]['path']);
$__t_assets[0]['alternateHref'] = $__t_assetManager->getPathFromStruct($__t_assets[0], 'web', $__t_assets[0]['primarySiteId'], $templateConstants['isPublishing'], $templateConstants['webRoot'], '', '', true);
$__t_assets[0]['alternatePath'] = $__t_assetManager->getPathFromStruct($__t_assets[0], 'physical', $__t_assets[0]['primarySiteId'], isPublished(), null, '', '', true);
if (isset($__t_assets[0]['captionOverride']) && strlen($__t_assets[0]['captionOverride'])) $__t_assets[0]['caption'] = $__t_assets[0]['captionOverride'];
$news['asset'] = $__t_assets[0];
}
else $news['asset'] = false;
$news['headline'] = $HEADLINE;
$news['date'] = $DATE;
$news['detailHref'] = $DETAIL_HREF;
$news['ordinal'] = $count+1;
$newsStruct[] = $news;
$count++;
?>
</template:item>
</template:list>
<template:if $templateConstants['isPublishing']><?php echo '<?php $newsStruct = ' . var_export($newsStruct, true) . '; ?>'; ?></template:if>
<template:code>
<?php
//**************************************************************************
//* MISCELLANEOUS
//**************************************************************************
// paging
$paging = array();
$paging['perPage'] = 20; // number of items per page
$paging['totalRows'] = count($newsStruct);
$paging['pageNum'] = gpc('page', 0);
$paging['totalPages'] = ceil($paging['totalRows'] / $paging['perPage']) - 1;
// figure out which item we are going to start with and slice the array so we
// only execute the sort on the items we will be displaying.
if ($paging['pageNum'] === 'all') {
$paging['viewAll'] = true;
$paging['pageNum'] = 0;
$paging['startRow'] = 0;
} else {
$paging['viewAll'] = false;
$paging['startRow'] = $paging['pageNum'] * $paging['perPage'];
$newsStruct = array_slice($newsStruct, ($paging['startRow'] ? $paging['startRow'] : 0), $paging['perPage']);
}
//$newsStruct = reorderStruct($newsStruct, 'dateCreated', 'desc');
renderPagingList($paging);
?>
<ul class="news list">
<?php
//**************************************************************************
//* DATA SETUP AND FORMATTING
//**************************************************************************
if (count($newsStruct)) {
foreach ($newsStruct as $item) {
?>
<li class="clearfix">
<?php if (@($item['thumb'])) { ?>
<a href="<?php echo $item['detailHref']; ?>"><img src="<?php echo $item['thumb']['href']; ?>" alt="<?php echo $item['thumb']['altText']; ?>" width="100" height="<?php echo TemplateFunctions::getImageHeight($item['thumb']['path']); ?>" class="floatleft" /></a>
<?php } ?>
<span class="date"><abbr class="dtstamp" title="##dateFormat('c', $item['date'])##">##dateFormat('m.d.Y', $item['date'])##</abbr></span><p>
<?php if (@($item['asset'])) { ?>
<?php $fileSize = ($item['asset']['fileSize']>(1024*1024)?round(($item['asset']['fileSize']/(1024*1024)),2) . ' MB':(round($item['asset']['fileSize']/1024)) . ' KB'); ?>
<a href="##$item['asset']['href']##" target="_blank">##$item['headline']##<span class="##substr($item['asset']['fileExtension'], 1, strlen($item['asset']['fileExtension']))##"> </span> <small>##$fileSize##</small></a>
<?php } else { ?>
<a href="##$item['detailHref']##">##$item['headline']##</a>
<?php } ?>
</p>
<?php
}
}
?>
</ul>
<?php
renderPagingList($paging);
?>
</template:code>
<template:if $LEAD_OUT>
##$LEAD_OUT##
</template:if>
Comments: