trouble with XML index [closed]

monster

New Member
i downloaded this xml-driven [news scroller]Here is the news.xml\[code\]<?xml version="1.0" encoding="utf-8" ?><newslist title="Latest News"> <news category="red" **url="www.egrappler.com"** date="01-01-2011"> ---> **TROUBLE HERE** </news></newslist>\[/code\]And here is the javascript code:\[code\](function ($) { $.fn.extend({ vscroller: function (options) { var settings = $.extend({ speed: 1000, stay: 2000, newsfeed: '', cache: true }, options); return this.each(function () { var interval = null; var mouseIn = false; var totalElements; var isScrolling = false; var h; var t; var wrapper = $(this).addClass('news-wrapper'); if (settings.newsfeed == '') { alert('No XML file specified'); return; } $.ajax({ url: settings.newsfeed, type: 'GET', dataType: 'xml', cache: settings.cache, success: function (xml) { //if there are news headlines then build the html var contentWrapper = $('<div/>').addClass('news-contents-wrapper'); var newsHeader = $('<div/>').addClass('news-header'); var newsContents = $('<div/>').addClass('news-contents'); wrapper.append(contentWrapper); contentWrapper.append(newsHeader); contentWrapper.append(newsContents); newsHeader.html($(xml).find('newslist').attr('title')); var i = 0; totalElements = $(xml).find('news').length; $(xml).find('news').each(function () { var news = $('<div/>').addClass('news'); newsContents.append(news); var history = $('<div/>').addClass('history'); var description = $('<div/>').addClass('description'); news.append(history); news.append(description); history.append(getCircle($(this).attr('category'), $(this).attr('date'))); var url = $(this).attr('url'); var htext = $(this).find('headline').text(); description.append($('<h1/>').html("<a href='" + url + "'>" + htext + "</a>")); var newsText = $(this).find('detail').text(); if (newsText.length > 80) { newsText = newsText.substr(0, 80) + "..."; } description.append($('<div/>').addClass('detail').html(newsText)); }); h = parseFloat($('.news:eq(0)').outerHeight()); $('.news', wrapper).each(function () { $(this).css({ top: i++ * h }); });\[/code\]I tried embeding php codes on the xml file by changing it to a php file, (like news.php) becoz these articles are stored in a database and has their own IDs..What im tryng to do is that when you click the title of the news, the ID from the database will be posted on the url($_GET method), and only the news with that ID will be displayed and be viewed by the user.What I dont know is how will I assign the URL on the XML file, somethin like the logic of this one (url="asdf.php?id="). ive tried this but it is not getting the ID from the database, instead it displays all the articles stored in the database. How will I do it?
 
Back
Top