Auto Feed

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

By design9 - June 7, 2012

I am auto feeding the top most 3 recent articles into a section on my home page. I have it working with no problem but I need to be able to exclude one category from feeding in. What is the best way to exclude a category from the top 3 most recent? My category is called "The Daily Post".

<?php
list($featuredarticlesoneRecords, $articlesMetaData) = getRecords(array(
'tableName' => 'blogs',
'limit' => '3',
));

?>

<?php foreach($featuredarticlesoneRecords as $record):?>
<?php if($count>3){$count=1;} ?>
<table width="574" height="30" border="0">
<tr>
<td width="3">&nbsp;</td>
<td width="150">
<?php $count=3;?>

<?php foreach ($record['photo'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" title="" style="border: solid 1px #4f4f4f;" /><br/>
<?php endif ?>
<?php endforeach ?> </td>
<td width="407"><h2><a href="<?php echo $record['_link'] ?>"><span class="articlehead"><?php echo $record['title'] ?></span></a></h2>
<p><?PHP echo maxWords($record['summary'], 25);?>...<a href="<?php echo $record['_link']; ?>">More</a> </p></td>
</tr>
</table><?php endforeach; ?>


Thanks!
April

Re: [design9] Auto Feed

By design9 - June 7, 2012

I think I figured it out. I just added a where clause and it is pulling in all categories except for the Daily Post.

list($featuredarticlesoneRecords, $articlesMetaData) = getRecords(array(
'tableName' => 'blogs',
'where' => "category NOT LIKE '%\tThe Daily Post\t%'",
'limit' => '3',
));

thanks!