Solved

Live "Feeds" on my Site

Posted on 2013-12-31
8
364 Views
Last Modified: 2014-01-01
I have a site that provides results for running events, nordic ski events, cross-country running, etc.  I would like to re-design our home page to provide continuous feeds (via something like an iframe or a plugin so that when folks come to the site for results they can get some news as well.

Thanks~
0
Comment
Question by:Bob Schneider
8 Comments
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
ID: 39749545
Sounds great. Do you have any issues with the site or looking for someone to do it for you?
0
 
LVL 16

Expert Comment

by:Imran Javed Zia
ID: 39749741
Hi,

For this you can use RSS.
You may just implement a RSS client for your home site. and may need to implement or consume RSS services from other data providers.

Thanks and Regards
0
 

Author Comment

by:Bob Schneider
ID: 39749848
Do you know of any resources for implementing this process?  Is it difficult to do for a hack programmer like myself?
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39749901
BobbaBuoy, This can be very easy.  

1) Create an ASP page as you already know how.
The page may simple contain a list of results from your db.  The page should not have anything else.  Just your list which could be a table or div's

Road Runner   14:58:12
Mr Magoo       15:24:32
Bugs Bunney   15:25:47
W. Coyote        15:38:25

or
Road Runner - 14:58:12  Mr Magoo - 15:24:3    Bugs Bunney -v15:25:47    W. Coyotev-v15:38:25
2) On the the home page, create an ajax post that brings in that page.
$.ajax({
  type: "POST",
  url: "results.asp"
})
  .done(function( data ) {
    $('div#ticker').html(data);
  });

Open in new window

The code above will place the data from results.asp to a div with the ID "ticker" on your home page.

You can wrap that in some type of timer that refreshes every x seconds.  

There are also ticker plug ins for jquery like http://jonmifsud.com/open-source/jquery/jquery-webticker/
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:Bob Schneider
ID: 39749920
Thanks but what I am looking for is feeds from things like Track & Field News, Runners World, NCAA Cross-Country, etc.  I woud like a set of "feeds" that have links that are posted by the host site that my users can simply click on if an article piques their interest.

I don't really want to go the i-frame route...I assume there is better technology for this out there, no?

Sorry if i have not made this clear.
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 39749943
You can still use this method.

$.ajax({
  type: "POST",
  url: "http://someothersite.com"
})
  .done(function( data ) {
    $('div#ticker').html(data);
  });

Open in new window

Except you would need to edit this portion " $('div#ticker').html(data);" for the data anyway where you only pull in what you want. This is not a frame it is actually placing the content on your page after it loads.   However, some of these sites already have feeds and it is best to use them.  Watch that the method I describe does not violate and TOS.  This is called screen scraping.  You would need to design the method specifically for each bit of content.

You can also do this server side with your vb script.  Below I have done virtually the same thing I describe above but using xmlhttp post.  Below is real coding I use to do the very same thing you are describing.

The xmlhttp post sends a get to somesite.com/somepage.aspx and it returns all the html.

I only am interested in the portion of code that is inside a <form></form> tag.  YOu will see I use the mid function to look through theHTML and just return starting at <form> and ending in </form>.

You will see some replace functions where I am eliminating or changing some of the html.  

Then finally response.write theHTML to my page.  I do have permission to do this.  Just make sure you avoid any copyright mess.
<%
    
	url = "http://somesite.com/somepage.aspx" 
    set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 

  
    xmlhttp.open "GET", url, false 
	xmlhttp.setRequestHeader "User-Agent","BobbaBuoy"
    xmlhttp.send "" 
	txtstart= instr(1,xmlhttp.responseText, "<form>",1) 
    txtend= instr(1,xmlhttp.responseText, "</form>",1)
	response.write("<div id=""xyzabc"">")
	theHtml= mid(xmlhttp.responseText, txtstart, txtend-txtstart)
    theHtml=replace(theHtml,"<form>","")
	theHtml=replace(theHtml," <div class=""content"">","")
	theHtml=replace(theHtml,"bgcolor=""#0B294D""","bgcolor=""#990000""")
	theHtml=replace(theHtml,"<a href=""somepage.aspx","<a target=""_blank"" href=""http://www.somesite.com/landingpage.aspx")
	
	
	theHtml=replace(theHtml,"src=""Images","src=""http://www.somesite.org/Images")
	response.write theHtml
	response.write("</div><!-- end -->")
    set xmlhttp = nothing 

%>

Open in new window

0
 

Author Closing Comment

by:Bob Schneider
ID: 39749964
Thank you so much!
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39749968
Thanks!  By the way, the jquery method I posted in the last post is not correct or that simple because it is cross domain.  Use the serverside xmlhttp post method.

Thanks! Happy New Year!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now