Results 1 to 7 of 7

Thread: Advanced RSS Ticker (Ajax invocation) : how to show categories

  1. #1
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Advanced RSS Ticker (Ajax invocation) : how to show categories

    1) Script Title: Advanced RSS Ticker (Ajax invocation)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ajax/index.htm

    3) Describe problem:
    how to show category for each item ?

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    This is untested, though it should work. Try the below:

    1) Inside bridge.php, find and edit the line:

    Code:
    foreach ($rs['items'] as $item) {
    echo "<item>\n<link>$item[link]</link>\n<title>$item[title]</title>\n<description>$item[description]</description>\n<pubDate>$item[pubDate]</pubDate>\n<category>$item[category]</category>\n </item>\n\n";
    Code in red is new.

    2), Inside rssticker.js, find and edit:

    Code:
    this.title=[], this.link=[], this.description=[], this.pubdate=[], this.category=[]
    And

    Code:
    this.pubdate[i]=this.feeditems[i].getElementsByTagName("pubDate")[0].firstChild.nodeValue
    this.category[i]=this.feeditems[i].getElementsByTagName("category")[0].firstChild.nodeValue
    Code in red is new.

    And:

    Code:
    var feeddate='<div class="rssdate">'+this.pubdate[this.pointer]+'</div>'
    var category='<div class="rsscategory">'+this.category[this.pointer]+'</div>'
    if (this.logicswitch.indexOf("description")==-1) description=""
    if (this.logicswitch.indexOf("date")==-1) feeddate=""
    var tickercontent=linktitle+feeddate+category+description //STRING FOR FEED CONTENTS
    Again, code in red is new.
    Last edited by ddadmin; 02-15-2007 at 09:25 AM.

  3. #3
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Initializing ticker...

    Thanks, i have put the new code but
    the ticker is showing "Initializing ticker... "

    Should i change something in the index.html to call categories ?

    new rssticker_ajax("lepouvoirprix", 1200, "ddbox", "bbcclass", 3500, "date+description")

    to

    new rssticker_ajax("lepouvoirprix", 1200, "ddbox", "bbcclass", 3500, "date+category+description")

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Nope, you shouldn't have to specify "category" within the list of parameters when invoking the script to display it. I'll have to check back later tonight when I can physically run the modification within a web server to see what's wrong.

  5. #5
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Apparently I left out a line to edit inside rssticker.js, which is:

    Code:
    this.title=[], this.link=[], this.description=[], this.pubdate=[], this.category=[]
    I've edited my post above as well to correct this. The result does work, which I've just test run. However, with the modication above, if an RSS feed doesn't contain a category element (not all do), the script will return an error. I've attached a modified version of rssticker.js that takes this into account. Use that instead.

  6. #6
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Advanced RSS Ticker (Ajax invocation)

    it works fine !!! thanks a lot !!!

    Last question : how can i change months in french :

    ie : Feb to Fev

  7. #7
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Under which component (ie: category, title etc) do the months appear inside the RSS feed? What you can do is edit the frontpage rssticker.js file to scan for replaces instances of certain words with another word of your choice.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •