RSS Feed Setup

12 posts by 4 authors in: Forums > CMS Builder
Last Post: September 3, 2009   (RSS)

By Chris - September 2, 2009 - edited: September 2, 2009

Hi Nigel,

Simply replace the red text below with any of the code snippets I posted above:

<description><?php echo htmlspecialchars($record['content']); ?></description>

Also, replacing the red text from the code snippet with:

$record['content']

Oh, and you'll probably want to change

echo $text;

to

echo htmlspecialchars($text);

Ugh. That's too much replacing. Here's a complete example:

<?php foreach ($top_storiesRecords as $record): ?>
<item>
<title><?php echo htmlspecialchars($record['title']) ?></title>
<link>http://www.yallaf1.com<?php echo $record['_link'] ?></link>
<description><?php
$text = $record['content'];
if (strlen($text) > 247):
$minCharsToRemove = strlen($text) - 247;
$text = preg_replace('/^(.*\S)\b.*?.{'.$minCharsToRemove.'}$/s', '\\1', $text) . "...";
endif;
echo htmlspecialchars($text);
?></description>
<pubDate><?php echo date("r", strtotime($record['date'])) ?></pubDate>
<guid isPermaLink="true">http://www.yallaf1.com<?php echo $record['_link'] ?></guid>
</item>
<?php endforeach ?>


Sorry that was so long-winded! Hope this helps! :D
All the best,
Chris