www.webdeveloper.com
Results 1 to 10 of 10

Thread: Create IFrames from RSS

  1. #1
    Join Date
    Sep 2009
    Posts
    6

    Question Create IFrames from RSS

    Hi,
    I am looking to create loads of iframes from an rss feed. In other words, display each page linked in the LINK field of the rss will be displayed in a seperate IFrame. I am reasonably new to this and am not really sure how to do this. How may I go about doing this?

    Thanks

  2. #2
    Join Date
    Oct 2006
    Posts
    939
    With firefox you can put the source code into an IFRAME and then paste it into a textarea or other form input, go from there to mainpualte the code ex:
    address-
    view-source:http://www.webdeveloper.com/forum/showthread.php?t=216944

    With IE, (this was posted the other day) can activeX the source code directly to manipuate the code as a string.

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>IEsrcCode</title>
    <style type="text/css">
    #srctx{font-family:fixedsys}
    </style>
    
    <script type="text/javascript">
    
    function getSrcFile(url){
        oxmlhttp = null;
        try{        oxmlhttp = new XMLHttpRequest();        oxmlhttp.overrideMimeType("text/xml");    }
        catch(e){
            try{      oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP");        }
            catch(e){          return null;        }
        }
        if(!oxmlhttp) return null;
        try{       oxmlhttp.open("GET",url,false);       oxmlhttp.send(null);    }
        catch(e){       return null;    }
    document.getElementById('srctx').value=oxmlhttp.responseText;
    
    }
    
    </script>
    
    </head>
    
    <body >                Paste address with http
    <input type=file onchange="getSrcFile(this.value)" size=50> <br>
    <textarea id="srctx" style="width:100%;" rows=30 wrap=off> abc def ghi jkl mno p</textarea>
    </body>
    With the srouce code now ready to work, its only a matter of identifying where to split() the string

    var q=x.split('<title>');
    var p=x.split('<link>');
    var n=x.split('Time:');
    var m=x.split('More in&lt;/span&gt;'); //http://www.youtube.com/watch?v=_tR8bORL91A
    var f=x.split('&lt;img alt="" src="'); //var w='watch'; var wp='watch_popup';



    This last bit of code I ripped out of my own project to re-write youtube rss pages. I don't use IFRAMEs, I put all the individual promos into table cells. When you get to know what you are doing, some RSS feeds are laid out different than others. Hence, your code will not work on all of them.

  3. #3
    Join Date
    Sep 2009
    Posts
    6

    Thanks

    Quote Originally Posted by justinbarneskin View Post
    With firefox you can put the source code into an IFRAME and then paste it into a textarea or other form input, go from there to mainpualte the code ex:
    address-
    view-source:http://www.webdeveloper.com/forum/sh...d.php?t=216944

    With IE, (this was posted the other day) can activeX the source code directly to manipuate the code as a string.

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>IEsrcCode</title>
    <style type="text/css">
    #srctx{font-family:fixedsys}
    </style>
    
    <script type="text/javascript">
    
    function getSrcFile(url){
        oxmlhttp = null;
        try{        oxmlhttp = new XMLHttpRequest();        oxmlhttp.overrideMimeType("text/xml");    }
        catch(e){
            try{      oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP");        }
            catch(e){          return null;        }
        }
        if(!oxmlhttp) return null;
        try{       oxmlhttp.open("GET",url,false);       oxmlhttp.send(null);    }
        catch(e){       return null;    }
    document.getElementById('srctx').value=oxmlhttp.responseText;
    
    }
    
    </script>
    
    </head>
    
    <body >                Paste address with http
    <input type=file onchange="getSrcFile(this.value)" size=50> <br>
    <textarea id="srctx" style="width:100%;" rows=30 wrap=off> abc def ghi jkl mno p</textarea>
    </body>
    With the srouce code now ready to work, its only a matter of identifying where to split() the string

    var q=x.split('<title>');
    var p=x.split('<link>');
    var n=x.split('Time:');
    var m=x.split('More in&lt;/span&gt;'); //http://www.youtube.com/watch?v=_tR8bORL91A
    var f=x.split('&lt;img alt="" src="'); //var w='watch'; var wp='watch_popup';



    This last bit of code I ripped out of my own project to re-write youtube rss pages. I don't use IFRAMEs, I put all the individual promos into table cells. When you get to know what you are doing, some RSS feeds are laid out different than others. Hence, your code will not work on all of them.
    Thanks for the reply. Looks great. Have just tested quickly and im afraid I do not quite understand how to use the split. I am new to all this. SO jus to clarify, if I get this split working, it should display lots of different IFRAMES containing the web pages linked in the LINK fields of the RSS?

  4. #4
    Join Date
    Oct 2006
    Posts
    939
    sorry, that would take quite a bit more effort.
    But the tool I gave is something to get you started.
    provide the specific RSS address and I'll see what can be done?

  5. #5
    Join Date
    Sep 2009
    Posts
    6
    Quote Originally Posted by justinbarneskin View Post
    sorry, that would take quite a bit more effort.
    But the tool I gave is something to get you started.
    provide the specific RSS address and I'll see what can be done?
    thankuou so much. The RSS address is http://www.bukisa.com/rss/people/serioussamp . I understand that this could be quite difficult. I have also asked this on Experts Exchange ( http://www.experts-exchange.com/Prog..._24745631.html ) but am yet to receive an answer at all from there.

  6. #6
    Join Date
    Oct 2006
    Posts
    939
    Hmmm, so you wish to have individual IFRAMES holding the link
    and descriptions? You want the links to open a new window or
    display the page in those IFRAMEs?

    I imagine the IFRAMEs will be something just big enough to hold the relevant HTML 400x300

  7. #7
    Join Date
    Sep 2009
    Posts
    6
    Quote Originally Posted by justinbarneskin View Post
    Hmmm, so you wish to have individual IFRAMES holding the link
    and descriptions? You want the links to open a new window or
    display the page in those IFRAMEs?

    I imagine the IFRAMEs will be something just big enough to hold the relevant HTML 400x300
    Kind of. I wish to have individual iframes holding the pages referenced as the link in the RSS. Thanks for all ur help.

  8. #8
    Join Date
    Oct 2006
    Posts
    939
    Well, here is to get started. With any other browser than IE, this is the clumsy way to do it. Its good this way, you may be able to see what is going on with the steps. The tool i gave above would eliminate all this, if this is for local application and IE only. I'm only grabbing the links and putting them into an Array (zLinks). You can then refer to their index to point your IFRAMEs to them.
    Paste the source code into the textarea and then click outside to fire the onchange event.

    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD><TITLE>Su8-49am20</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=UTF-8">
    <STYLE type=text/CSS>
    
    
    </STYLE>
    <SCRIPT type="text/javascript">
    var page='http://www.bukisa.com/rss/people/serioussamp';
    	 var zLinks=new Array();
    function abc(x){
             var p=x.split('<link>');
    	var q=''
    		 for(i=0;i<p.length;i++){
    				if(p[i]){zLinks[i]=''+p[i].substring(0,p[i].indexOf('<'))+''}
    			}
    for(j=0;j<zLinks.length;j++){q+="zLinks["+j+"]='"+zLinks[j]+"';<br>";}
     document.getElementById('linqs').innerHTML=q;
    
    }
    
    </SCRIPT>
    <META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
    <BODY scroll="auto">
    <div id="linqs" >zLinks=new Array()</div>
    <SCRIPT type="text/javascript">
    if(navigator.appName!='Microsoft Internet Explorer'){        //FIREFOX
    	document.write('<iframe src="view-source:'+page+'" style="height:30px;width:60px"></iframe> Select all, copy & paste into textarea')
    }
    else{	document.write('<iframe src="'+page+'" style="height:30px;width:60px"></iframe> right click to view source. select all, copy & paste into textarea')}
    </SCRIPT>
    <textarea id="tx" style="height:80%;width:100%" onchange="abc(this.value)"></textarea>
    
    </BODY></HTML>
    

  9. #9
    Join Date
    Sep 2009
    Posts
    6

    Great!

    Wow this is great! If I can get it into an array I can easily take it from there. Just a couple of things, this returns the following which includes the 3 bad URLs. I can see why this is happening, and totally undertasnd that. Is it possible to skip first 3 when doing a loop?

    How can I use this to automatically retrieve the XML?


    Code:
    zLinks[0]='';
    zLinks[1]='http://www.bukisa.com/people/serioussamp';
    zLinks[2]='http://www.bukisa.com/people/serioussamp';
    zLinks[3]='http://www.bukisa.com/articles/30835_how-to-build-your-house-in-sketchup';
    zLinks[4]='http://www.bukisa.com/articles/79664_analysis-of-william-blakess-quotthe-tygerquot';
    zLinks[5]='http://www.bukisa.com/articles/29589_the-truth-of-911';
    Thanks,
    Sam.

  10. #10
    Join Date
    Oct 2006
    Posts
    939
    You can use post #3 and IE. It will require some knowledge of you, please.

    Glad you know why the links are coming out the way they do, start your loop with a good one:

    for(i=3;i<zLinks.length;i++){doStuffwith zLinks[i]}

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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