p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Ajax ISBN: 978-0-471-77778-6
This is the forum to discuss the Wrox book Professional Ajax by Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett; ISBN: 9780471777786
Important: For the new 2nd edition of this book, please post here instead: [url="http://p2p.wrox.com/forum.asp?FORUM_ID=307"]http://p2p.wrox.com/forum.asp?FORUM_ID=307[/url]

Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Ajax ISBN: 978-0-471-77778-6 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 17th, 2006, 10:59 AM
Registered User
 
Join Date: Apr 2006
Location: Fortson, GA, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dangerduck Send a message via Yahoo to dangerduck
Default News Ticker

I am trying to complete the NewsTicker widget. I'm writing newsticker.js right i even downloaded the code and it still will not work.

Code:
if ( isset( $_GET["http://www.ledger-enquirer.com/mld/ledgerenquirer/news/breaking_news/rss.xml"] ) ) {

    $remoteUrl = $_GET["http://www.ledger-enquirer.com/mld/ledgerenquirer/news/breaking_news/rss.xml"];

    $xml = file_get_contents($remoteUrl);


That is the url that the feed i want is located. The following is the include section of the default.htm file:
Code:
    <link rel="stylesheet" type="text/css" href="css/newsticker.css" />
    <script type="text/javascript" src="js/zxml.js"></script>
    <script type="text/javascript" src="js/xparser.js"></script>
    <script type="text/javascript" src="js/newsticker.js"></script>
    <script type="text/javascript">
    function init() {
        var newsTicker = new NewsTicker();    
        newsTicker.add("http://www.ledger-enquirer.com/mld/ledgerenquirer/news/breaking_news/rss.xml");        
    }

    onload = init;


And this is my newsticker.js Xparser initiation:

Code:
NewsTickerFeed.prototype.populateTicker = function (sXml) {
    var oParser = new XParser("http://www.ledger-enquirer.com/mld/ledgerenquirer/news/breaking_news/rss.xml", true);

    var spanLinkContainer = document.createElement("span");

    var aFeedTitle = document.createElement("a");
    aFeedTitle.className = "newsTicker-feedTitle";
    aFeedTitle.href = oParser.link.value;
    aFeedTitle.target = "_new";
    aFeedTitle.innerHTML = oParser.title.value;


    spanLinkContainer.appendChild(aFeedTitle);

    for (var i = 0; i < oParser.items.length; i++) {
        var item = oParser.items[i];

        var aFeedLink = document.createElement("a");
        aFeedLink.href = item.link.value;
        aFeedLink.target = "_new";
        aFeedLink.className = "newsTicker-feedItem";
        aFeedLink.innerHTML = item.title.value;

        spanLinkContainer.appendChild(aFeedLink);
    }


You can see the javascript errors at this url. http://www.thrivenews.com/NewsTicker/
I'm getting 2 errors right now. one is "Xparser is not defined" the other is in the php "no element found"...

Please, I would love any help..... :)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old April 17th, 2006, 11:17 AM
jmcpeak's Avatar
Wrox Author
Points: 130, Level: 2
Points: 130, Level: 2 Points: 130, Level: 2 Points: 130, Level: 2
Activity: 10%
Activity: 10% Activity: 10% Activity: 10%
 
Join Date: Nov 2005
Location: , Texas, USA.
Posts: 33
Thanks: 0
Thanked 2 Times in 2 Posts
Default

[Edit] Writing reply =)

------------------------
Jeremy McPeak
Author, Professional Ajax
http://www.wdonline.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old April 17th, 2006, 01:48 PM
Registered User
 
Join Date: Apr 2006
Location: Fortson, GA, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dangerduck Send a message via Yahoo to dangerduck
Default

Cool thanks I really want to see what is wrong. :) I have been working on this of and on for 3 weeks.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old April 18th, 2006, 09:37 AM
jmcpeak's Avatar
Wrox Author
Points: 130, Level: 2
Points: 130, Level: 2 Points: 130, Level: 2 Points: 130, Level: 2
Activity: 10%
Activity: 10% Activity: 10% Activity: 10%
 
Join Date: Nov 2005
Location: , Texas, USA.
Posts: 33
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I'm at work; therefore, I cannot access your web site (network Nazis). I can, though, comment on the code you've posted. =)

The main thing I see are the changes you've made to the code. From what I'm seeing, they are unnecessary changes. The widget is designed to pick up any RSS/Atom feed, so all you have to do is create a NewsTicker object and add a feed:
Code:
var myNewsTicker = new NewsTicker();

myNewsTicker.add("http://www.ledger-enquirer.com/mld/ledgerenquirer/news/breaking_news/rss.xml");
That should get it working for you.


------------------------
Jeremy McPeak
Author, Professional Ajax
http://www.wdonline.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old April 18th, 2006, 12:05 PM
Registered User
 
Join Date: Apr 2006
Location: Fortson, GA, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dangerduck Send a message via Yahoo to dangerduck
Default

Thanks I'll give this a try and let you know how it goes.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old April 18th, 2006, 12:20 PM
Registered User
 
Join Date: Apr 2006
Location: Fortson, GA, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dangerduck Send a message via Yahoo to dangerduck
Default

I did what you suggested And I'm getting a new javascript error now.

Error: oToAppend has no properties
Source File: http://www.thrivenews.com/NewsTicker/js/newsticker.js
Line: 22

And that is an unmodified version of the newsticker.js file. I just pulled it off the site.

Here is the code for the html page that I'm testing the ticker on.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Ajax News Ticker</title>
    <link rel="stylesheet" type="text/css" href="css/newsticker.css" />
    <script type="text/javascript" src="js/zxml.js"></script>
    <script type="text/javascript" src="js/xparser.js"></script>
    <script type="text/javascript" src="js/newsticker.js"></script>
    <script type="text/javascript">
    var myNewsTicker = new NewsTicker();
        myNewsTicker.add("http://www.ledger-enquirer.com/mld/ledgerenquirer/news/breaking_news/rss.xml");
    </script>
</head>    
<body>
</body>
</html>
I would love some help... Thanks for helping me get this down to one error. :)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #7 (permalink)  
Old April 19th, 2006, 01:09 PM
jmcpeak's Avatar
Wrox Author
Points: 130, Level: 2
Points: 130, Level: 2 Points: 130, Level: 2 Points: 130, Level: 2
Activity: 10%
Activity: 10% Activity: 10% Activity: 10%
 
Join Date: Nov 2005
Location: , Texas, USA.
Posts: 33
Thanks: 0
Thanked 2 Times in 2 Posts
Default

The creation of a NewsTicker object much take place when the page loads. This is a necessity because the HTML elements created by the NewsTicker is appended to either the document's body, or the supplied HTMLElement passed to the constructor. Running the script when the page loads ensures the document is completely loaded, and the HTML elements can be appended to the document. Otherwise, an error is thrown (the one you're seeing) stating that the element doesn't exist.

------------------------
Jeremy McPeak
Author, Professional Ajax
http://www.wdonline.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #8 (permalink)  
Old April 20th, 2006, 06:50 AM
Registered User
 
Join Date: Apr 2006
Location: Fortson, GA, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dangerduck Send a message via Yahoo to dangerduck
Default

Ok I'm getting no errors now I stuck that myNewsticker into a function. But it's still not working. And I have now errors.

Code:
 
<link rel="stylesheet" type="text/css" href="css/newsticker.css" />
    <script type="text/javascript" src="js/zxml.js"></script>
    <script type="text/javascript" src="js/xparser.js"></script>
    <script type="text/javascript" src="js/newsticker.js"></script>

    <script type="text/javascript">
    function init(){
    var myNewsTicker = new NewsTicker();
        myNewsTicker.add("http://www.ledger-enquirer.com/mld/ledgerenquirer/news/breaking_news/rss.xml");
    }
    </script>
This is a new feat though no errors. I guess I could go try it in IE havent done that but I doubt it will work. Thanks for all your help and if you have any more please feel free....:)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #9 (permalink)  
Old April 21st, 2006, 08:09 AM
Registered User
 
Join Date: Apr 2006
Location: Fortson, GA, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dangerduck Send a message via Yahoo to dangerduck
Default

Now I'm getting another js error

XParser not defined

:(

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Separating news from the articles and add news pic Isaak BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 December 12th, 2006 11:25 AM
using javascript ticker in asp.net vivek_inos ASP.NET 1.0 and 1.1 Professional 1 June 5th, 2006 01:05 PM
news ticker functionality badgolfer Classic ASP Basics 1 October 15th, 2004 01:37 AM
news ticker badgolfer ASP.NET 1.0 and 1.1 Basics 0 October 13th, 2004 04:34 AM
problem with News Ticker Application benito BOOK: ASP.NET Website Programming Problem-Design-Solution 2 September 1st, 2004 04:22 AM



All times are GMT -4. The time now is 12:00 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc