Current code gives me output to “li”, and I want to adjust the output to be in valid XML so I can create RSS feed from that list. Any advice?
Here is my code so far:
<?php
session_start();
mb_internal_encoding( 'UTF-8' );
require_once('../config.php');
require_once('../dbconnect.php');
echo ' <div class="tagsz clearfix"> ';
echo "<ul id='mytags_ara'>";
echo "<h2 class='title'>English Trends</h2>";
echo ' <div class="tagsz clearfix"> ';
echo "<ul id='mytags_en'>";
$query = "SELECT hashtag, sum(count) as total FROM `trending_topics` WHERE lang=0 and hashtag != '' and date >= date_sub(left(now(), 10), interval 1 day) group by hashtag order by total desc";
$res = mysql_query($query);
$index = 0;
$hashtags = null;
while($row = mysql_fetch_assoc($res) ) {
$hashtag = $row['hashtag'];
if( strtolower($hashtag) != 'newnew' && strtolower($hashtag) != 'new' && strtolower ($hashtag) != 'more' ) {
echo "<li><a class='size".$index."'".$hashtag."'>#".$hashtag."</a></li>";
$index++;
}
if($index==6) break;}
echo "</ul>";
echo "</div>";
?>
This may or may not help you out, but this was the code I used to use to generate an Atom feed:
It should give you an idea of how to do this manually. HTH.