www.webdeveloper.com
Results 1 to 3 of 3

Thread: linking live info

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Posts
    18

    Talking linking live info

    Been told this is an XML issue... What is the best way to copy a section of a website into your own?

    I was looking at taking some infomation, HTML code, from a public website that changes everyday...

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,136
    Few things to notice

    First the public site should maintain an XML file updated for you to read it every time and update the contents.

    Second you should be able to read XML file and insert data in your pages

    you should have some access to server side scripting to get this done with some reliability
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  3. #3
    Join Date
    Nov 2003
    Location
    Worthington, OH, USA
    Posts
    3,634
    Feeds like these are also referred to as RSS feeds. Here's a little code for RSS to get you started:

    PHP Code:
    function parseRSS(rsslinkChannelDesc) { 
        var 
    newxml document.createElement('XML'); 
        
    newxml.async false
        var 
    LinkCheck=newxml.load(rsslink);
        var 
    strHTML='';
        var 
    siteTitle='';

        if (
    LinkCheck){
            if(
    newxml.selectNodes('//channel').item(0).selectSingleNode('title'))
                var 
    siteTitle=newxml.selectNodes('//channel').item(0).selectSingleNode('title').text
            if (
    newxml.selectNodes('//channel').item(0).selectSingleNode('copyright'))
                
    siteTitle += '<br><font size=-4>'+newxml.selectNodes('//channel').item(0).selectSingleNode('copyright').text+'</font><br>';
            var 
    siteImage=' ';
            if (
    newxml.selectNodes('//image').length 0){
                var 
    siteImage='<img src="'+newxml.selectNodes('//image').item(0).selectSingleNode('url').text;
                
    siteImage += '" width='+newxml.selectNodes('//image').item(0).selectSingleNode('width').text;
                
    siteImage += ' height='+newxml.selectNodes('//image').item(0).selectSingleNode('height').text+'>';
            }

            
    strHTML '<table border=0><th style="font-size: 14;" bgcolor="#ADD8E6">'+siteTitle+siteImage+'</th>'

            if (
    newxml.selectNodes('//channel').item(0).selectSingleNode('description') && ChannelDesc ){
                
    strHTML += '<tr bgcolor="#ADD8E6"><td style="font-size: 10;">';
                
    strHTML += newxml.selectNodes('//channel').item(0).selectSingleNode('description').text;
                
    strHTML += '</td></tr>';
            }

            if (
    newxml.selectNodes('//item')){
                var 
    newsitems newxml.selectNodes('//item'); 
                for(
    0newsitems.lengthi++) { 
                    
    strHTML +='<tr bgcolor="#ADFFE6"><td style="font-size: 14;">'
                    
    if (newsitems.item(i).selectSingleNode('link'))
                         
    strHTML += '<a href="'+newsitems.item(i).selectSingleNode('link').text +'"> '
                    if (
    newsitems.item(i).selectSingleNode('title'))
                        
    strHTML += '<b>'+newsitems.item(i).selectSingleNode('title').text '</b>'
                    
    strHTML += "</a></td></tr>";
                    if (
    newsitems.item(i).selectSingleNode('description'))
                        
    strHTML += '<tr><td style="font-size: 14;">'+newsitems.item(i).selectSingleNode('description').text+'</td></tr>';
                } 

                
    strHTML += "</table>"
            }
        }else 
    strHTML='<table border=0><th style="font-size: 14;" bgcolor="#ADD8E6">Invalid Link:<br>'+rsslink+'</th></table>';
        return 
    strHTML

    ...

    <
    div id="RssFeed"....>

    <
    script>RssFeed.innerHTML=parseRSS(linkdesc);</script>
    ... 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles