<script type="text/javascript">
google.load("feeds", "1");
function initialize() {
var feed = new google.feeds.Feed("http://www.cndp.fr/crdp-limoges/index.php?id=155&type=100");
feed.setNumEntries(30);
feed.load(function(result) {
if (!result.error) {
var container = document.getElementById("articles");
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
var a = document.createElement("a");
$(a).attr("href", "#pActualité?id="+i);
var div = document.createElement("div");
a.appendChild(div);
var date = new Date(entry.publishedDate);
monthNames =
[ 'Janvier', 'Fevrier', 'Mars', 'Avril', 'Mai', 'Juin',
'Juillet', 'Aout', 'Septembre', 'Octobre', 'Novembre', 'Decembre' ];
date =
date.getDate()+ ' ' +
monthNames[ date.getMonth() ] + ' ' + date.getFullYear();
$(div).html("<p><u>"+entry.title+"</u></p>"+"<p>"+date+"</p>"+"<p>"+entry.contentSnippet+"</p>");
$(div).addClass('cadre article');
$(div).attr('id', 'art'+i);
$(div).on("tap", function(){
$("#article").html("<p><b><u>"+entry.title+"</u></b></p>"+"<p>"+date+"</p>"+"<p>"+entry.content+"</p>"+"<p><a href="+entry.link+">Voir l\'article sur le site Web</a></p>");
}); //this is where I create the details of my news
container.appendChild(a);
}
}
});
}
google.setOnLoadCallback(initialize);
</script>
<div data-role="page" id="pActualité">
<div data-role="header">
</div>
<div data-role="main" class="ui-content">
<div data-role="header" class="header">
Détail actualité <a href="#pAccueil" data-role="button" data-rel="back" class="ui-btn ui-btn-right ui-corner-all droite">Retour</a>
</div>
<div data-role="main" class="ui-content cadre" id="article">
</div>
</div>
<div data-role="footer">
</div>
</div>
Actually I've got 30 entries with my rss, and when I tap a div, for exemple on the 5th, It should generate the right html (which shows a better descriptionof the news), but it always generates the html of the 30th.
Maybe it is an algorithmic problem but I don't see where the problem is so I wish you help me, thanks !