1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
577:
578:
579:
580:
581:
582:
583:
584:
585:
586:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
599:
600:
601:
602:
603:
604:
605:
606:
607:
608:
609:
610:
611:
612:
613:
614:
615:
616:
617:
618:
619:
620:
621:
622:
623:
624:
625:
626:
627:
628:
629:
630:
631:
632:
633:
634:
635:
636:
637:
638:
639:
640:
641:
642:
643:
644:
645:
646:
647:
648:
649:
650:
651:
652:
653:
654:
655:
| # 1 Case: ASP .NET C# and jquery ui tab
-------------------------------------------------------
ASPX File
........................
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ASP_Jquery.aspx.cs" Inherits="ASP_Jquery" %>
<!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 runat="server">
<title></title>
<link rel="stylesheet" type="text/css" href="AJAXPHP/style.css" />
<script type="text/javascript">
$(document).ready(function () {
//alert("TEST2");
});
</script>
<link type="text/css" href="css/dot-luv/jquery-ui-1.8.4.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.4.custom.min.js"></script>
<script type="text/javascript" src="http://swip.codylindley.com/jquery.DOMWindow.js"></script>
<script type="text/javascript">
$(function () {
// alert("TEST");
// Accordion
$("#accordion").accordion({ header: "h3" });
$("#me").css("display", "block"); $("#cnn").css("display", "block"); $("#yahoo").css("display", "block");
$("#nelp").css("display", "block"); $("#obama").css("display", "block"); $("#ms").css("display", "block");
$("#anderson").hide().fadeIn(2000); $("#andersonImage").hide().fadeIn(2000);
});
</script>
<style type="text/css">
.style1
{
width: 400px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div id="page-wrap">
<div id="inside">
<div id="header">
Daily Twitter
</div>
<div id="subHeader"><a href="http://twitter.com/andersoncooper">AC</a>
<a href="http://twitter.com/cnn">cnn</a>  
<a href="http://twitter.com/cnn">CNN</a> 
<a href="http://twitter.com/yahoo">Yahoo!</a>  
<a href="http://twitter.com/cnn">Barack Obama</a> 
<a href="http://twitter.com/nelp">Nelp</a>  
<a href="http://twitter.com/microsoft">Microsoft</a></div>
<!-- Tabs -->
<!-- Accordion -->
<div id="accordion">
<div>
<h3><a href="#">Reporter Anderson Cooper's Twitts</a></h3>
<div id ="div1">
<table width="98%"><tr>
<td valign="top"> <a href="http://ac360.blogs.cnn.com/" class="absoluteIframeDOMWindow"><img src="andersoncooper.jpg" alt="ac" height="400" width="300" id = "andersonImage" style="display:none;" /></a>
<script type="text/javascript">
$('.absoluteIframeDOMWindow').openDOMWindow({
height: 400,
width: 700,
positionType: 'absolute',
positionTop: 150,
eventType: 'click',
positionLeft: 300,
windowSource: 'iframe',
windowPadding: 0,
loader: 1,
loaderImagePath: 'animationProcessing.gif',
loaderHeight: 16,
loaderWidth: 17
});
</script>
</td>
<td valign="top" style="padding: 5px 10px 20px 30px;">
<span id = "anderson" style="display:none;">
<asp:Label ID="Label1" Visible="false" runat="server"/>
<asp:Image ID="Image1" Visible="false" runat="server" ImageUrl="http://blogs.ft.com/techblog/files/2009/08/twitter_fail_whale.jpg" AlternateText="Twitter Service is broken" />
<asp:repeater id="Repeater1" runat="server">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<a href='<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("link").InnerText%>'>
<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("pubDate").InnerText%></a><br />
<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("description").InnerText%><br /><br />
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:repeater>
</span>
</td>
</tr></table>
</div>
</div>
<div>
<h3><a href="#" id="me" style="display:none;">Parrottweet</a></h3>
<div id ="div2" style="display:none;">
<table width="98%"><tr>
<td valign="top"><img src="me.jpg" alt="ac" height="400" width="300" /></td>
<td valign="top" style="padding: 5px 10px 20px 30px;">
<asp:Label ID="Label2" Visible="false" runat="server"/>
<asp:Image ID="Image2" Visible="false" runat="server" ImageUrl="http://blogs.ft.com/techblog/files/2009/08/twitter_fail_whale.jpg" AlternateText="Twitter Service is broken" />
<asp:repeater id="Repeater2" runat="server">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<a href='<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("link").InnerText%>'>
<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("pubDate").InnerText%></a><br />
<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("description").InnerText%><br /><br />
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:repeater>
</td>
</tr></table>
</div>
</div>
<div>
<h3><a href="#" id="cnn" style="display:none;">CNN's Twitts</a></h3>
<div id ="div3" style="display:none;">
<table width="98%"><tr>
<td valign="top"><img src="cnn1.jpg" alt="ac" height="400" width="300" /></td>
<td valign="top" style="padding: 5px 10px 20px 30px;">
<asp:Label ID="Label3" Visible="false" runat="server"/>
<asp:Image ID="Image3" Visible="false" runat="server" ImageUrl="http://blogs.ft.com/techblog/files/2009/08/twitter_fail_whale.jpg" AlternateText="Twitter Service is broken" />
<asp:repeater id="Repeater3" runat="server">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<a href='<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("link").InnerText%>'>
<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("pubDate").InnerText%></a><br />
<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("description").InnerText%><br /><br />
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:repeater>
</td>
</tr></table>
</div>
</div>
<div>
<h3><a href="#" id="yahoo" style="display:none;">Yahoo!'s Twitts</a></h3>
<div id ="div4" style="display:none;">
<table width="98%"><tr>
<td valign="top"><img src="yahoo.png" alt="ac" height="400" width="300" /></td>
<td valign="top" style="padding: 5px 10px 20px 30px;">
<asp:Label ID="Label4" Visible="false" runat="server" />
<asp:Image ID="Image4" Visible="false" runat="server" ImageUrl="http://blogs.ft.com/techblog/files/2009/08/twitter_fail_whale.jpg" AlternateText="Twitter Service is broken" />
<asp:repeater id="Repeater4" runat="server">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<a href='<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("link").InnerText%>'>
<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("pubDate").InnerText%></a><br />
<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("description").InnerText%><br /><br />
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:repeater>
</td>
</tr></table>
</div>
</div>
<div>
<h3><a href="#" id="nelp" style="display:none;">Nelp's Twitts</a></h3>
<div id ="div5" style="display:none;">
<table width="98%"><tr>
<td valign="top"><img src="nelp-mini.png" alt="ac" height="400" width="300" /></td>
<td valign="top" style="padding: 5px 10px 20px 30px;">
<asp:Label ID="Label5" Visible="false" runat="server"/>
<asp:Image ID="Image5" Visible="false" runat="server" ImageUrl="http://blogs.ft.com/techblog/files/2009/08/twitter_fail_whale.jpg" AlternateText="Twitter Service is broken" />
<asp:repeater id="Repeater5" runat="server">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<a href='<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("link").InnerText%>'>
<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("pubDate").InnerText%></a><br />
<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("description").InnerText%><br /><br />
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:repeater>
</td>
</tr></table>
</div>
</div>
<div>
<h3><a href="#" id="obama" style="display:none;">Barack Obama's Twitts</a></h3>
<div id ="div6" style="display:none;">
<table width="98%"><tr>
<td valign="top"><img src="barackobama.jpg" alt="ac" height="400" width="300" /></td>
<td valign="top" style="padding: 5px 10px 20px 30px;">
<asp:Label ID="Label6" Visible="false" runat="server"/>
<asp:Image ID="Image6" Visible="false" runat="server" ImageUrl="http://blogs.ft.com/techblog/files/2009/08/twitter_fail_whale.jpg" AlternateText="Twitter Service is broken" />
<asp:repeater id="Repeater6" runat="server">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<a href='<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("link").InnerText%>'>
<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("pubDate").InnerText%></a><br />
<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("description").InnerText%><br /><br />
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:repeater>
</td>
</tr></table>
</div>
</div>
<div>
<h3><a href="#" id="ms" style="display:none;">Microsoft's Twitts</a></h3>
<div id ="div7" style="display:none;">
<table width="98%"><tr>
<td valign="top"><img src="microsoft.png" alt="ac" height="400" width="300" /></td>
<td valign="top" style="padding: 5px 10px 20px 30px;">
<asp:Label ID="Label7" Visible="false" runat="server"/>
<asp:Image ID="Image7" Visible="false" runat="server" ImageUrl="http://blogs.ft.com/techblog/files/2009/08/twitter_fail_whale.jpg" AlternateText="Twitter Service is broken" />
<asp:repeater id="Repeater7" runat="server">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<a href='<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("link").InnerText%>'>
<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("pubDate").InnerText%></a><br />
<%#((System.Xml.XmlNode)Container.DataItem).SelectSingleNode("description").InnerText%><br /><br />
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:repeater>
</td>
</tr></table>
</div>
</div>
</div>
<div style="clear: both;"></div>
<div id="footer"><h3>Information at Footer</h3></div>
</div>
</div>
</form>
</body>
</html>
..................................................................
Code Behind---C#
......................
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Xml;
public partial class ASP_Jquery : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e){
string[] urls = new string[7] { "http://twitter.com/statuses/user_timeline/15224867.rss", "http://twitter.com/statuses/user_timeline/15224867.rss",
"http://twitter.com/statuses/user_timeline/759251.rss", "http://twitter.com/statuses/user_timeline/19380829.rss", "http://twitter.com/statuses/user_timeline/78461452.rss",
"http://twitter.com/statuses/user_timeline/813286.rss","http://twitter.com/statuses/user_timeline/24741685.rss" };
HttpCookie MyCookie = new HttpCookie("LastVisit");
DateTime now = DateTime.Now;
MyCookie.Value = now.ToString();
MyCookie.Expires = now.AddHours(1);
Response.Cookies.Add(MyCookie);
if (!IsPostBack)
{
for (int i = 0; i < 7; i++)
{
XmlDocument xml = new XmlDocument();
XmlNodeList nodes = xml.SelectNodes("/rss/channel/item");
try
{
xml.Load(urls[i]);
if (i == 0){
xml.Load(urls[i]);
Repeater1.DataSource = nodes;
Repeater1.DataBind();
}
else if (i == 1){
xml.Load(urls[i]);
Repeater2.DataSource = nodes;
Repeater2.DataBind();
}
else if (i == 2){
xml.Load(urls[i]);
Repeater3.DataSource = nodes;
Repeater3.DataBind();
}
else if (i == 3){
xml.Load(urls[i]);
Repeater4.DataSource = nodes;
Repeater4.DataBind();
}
else if (i == 4){
xml.Load(urls[i]);
Repeater5.DataSource = nodes;
Repeater5.DataBind();
}
else if (i == 5){
xml.Load(urls[i]);
Repeater6.DataSource = nodes;
Repeater6.DataBind();
}
else if (i == 6){
xml.Load(urls[i]);
Repeater7.DataSource = nodes;
Repeater7.DataBind();
}
}
catch (Exception error){
string errorMessage = "Either Twitter rss service or main web service is down<br/>Error Message: ";
Image1.Visible = true; Image2.Visible = true; Image3.Visible = true; Image4.Visible = true; Image5.Visible = true; Image6.Visible = true;Image7.Visible = true;
Label1.Visible = true; Label2.Visible = true; Label3.Visible = true; Label4.Visible = true; Label5.Visible = true; Label6.Visible = true;Label7.Visible = true;
Label1.Text = errorMessage + error.Message; Label2.Text = errorMessage + error.Message; Label3.Text = errorMessage + error.Message;
Label4.Text = errorMessage + error.Message; Label5.Text = errorMessage + error.Message; Label6.Text = errorMessage + error.Message; Label7.Text = errorMessage + error.Message;
}
}
}
}
}
-------------------------------------------------------------
#2 Case ( Yahoo Pipe, JavaScript, and PHP)
.................
JS file
flag = 0; var i = 0; var myArray = new Array(7);
var names = new Array("ac", "me", "cnn", "yahoo", "nelp", "obama", "ms");
function getFeed() {
var newScript = document.createElement('script');
newScript.type = 'text/javascript';
myArray[0] = "http://pipes.yahoo.com/pipes/pipe.run?_id=0fe4e5149d6346e748e4b0e5a424197e&_render=json&_callback=myfunction";
myArray[1] = "http://pipes.yahoo.com/pipes/pipe.run?_id=0fe4e5149d6346e748e4b0e5a424197e&_render=json&_callback=myfunction";
myArray[2] = "http://pipes.yahoo.com/pipes/pipe.run?_id=74b96e2551b4c024a1300803e09d0401&_render=json&_callback=myfunction";
myArray[3] = "http://pipes.yahoo.com/pipes/pipe.run?_id=fffd88d2544ad48b0352f22414a30afb&_render=json&_callback=myfunction";
myArray[4] = "http://pipes.yahoo.com/pipes/pipe.run?_id=16b91210f014087d5e0ccaab0aec0c7e&_render=json&_callback=myfunction";
myArray[5] = "http://pipes.yahoo.com/pipes/pipe.run?_id=895e6164c61b2ee9f7fd73b8e16a71b1&_render=json&_callback=myfunction";
myArray[6] = "http://pipes.yahoo.com/pipes/pipe.run?_id=490fc765697c7bac6412ba62a6c71473&_render=json&_callback=myfunction";
if (i < 7) {
newScript.src = myArray[i];
}
else if (i == 7) {
return;
}
document.getElementsByTagName("head")[0].appendChild(newScript);
}
function fetchDataByPHP(i) {
myStr = "";
if (i == 0) {
myStr = names[i];
} else if (i == 1) {
myStr = names[i];
}
else if (i == 2) {
myStr = names[i];
}
else if (i == 3) {
myStr = names[i];
}
else if (i == 4) {
myStr = names[i];
}
else if (i == 5) {
myStr = names[i];
}
else if (i == 6) {
myStr = names[i];
}
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
var j = i;
j = j + 1;
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
// alert(xmlhttp.responseText);
myStr = xmlhttp.responseText;
tempDiv = "div" + j;
document.getElementById(tempDiv).innerHTML = myStr;
}
}
xmlhttp.open("GET", "fetchDataByCurl.php?q=" + myStr, true);
xmlhttp.send();
}
function myfunction(feed) {
str = "";
if (feed.value.items.length == 0) {
fetchDataByPHP(i);
i++;
getFeed();
}
else {
// alert(feed.value.items[0].description);
for (j = 0; j <= 8; j++) {
var tmpDate = feed.value.items[j].pubDate;
tmpDate = formatDate(tmpDate);
str += "At <a href='" + feed.value.items[j].link + "'>" + tmpDate + "</a><br/>";
str += feed.value.items[j].description + "<br/><br/>";
}
displayData(str);
i++;
getFeed();
}
}
function displayData(str) {
var ac = "<table border='2' width='100%'>";
if (i == 0) {
ac += "<tr><td valign='top' class='style2'><img src='andersoncooper.jpg'/></td><td>";
document.getElementById('div1').innerHTML = ac + str + "</td></tr></table>";
}
if (i == 1) {
ac += "<tr><td valign='top' class='style2'><img src='andersoncooper.jpg' height='100%'/></td><td>";
document.getElementById('div2').innerHTML = ac + str + "</td></tr></table>";
}
if (i == 2) {
ac += "<tr><td valign='top' class='style2'><img src='cnn1.jpg'/></td><td>";
document.getElementById('div3').innerHTML = ac + str + "</td></tr></table>";
}
if (i == 3) {
ac += "<tr><td valign='top' class='style2'><img src='yahoo.png' height='400px' width='304px'/></td><td>";
document.getElementById('div4').innerHTML = ac + str + "</td></tr></table>";
}
if (i == 4) {
ac += "<tr><td valign='top' class='style2'><img src='nelp-mini.png' height='100%'/></td><td>";
document.getElementById('div5').innerHTML = ac + str + "</td></tr></table>";
}
if (i == 5) {
ac += "<tr><td valign='top' class='style2'><img src='barackobama.jpg'/></td><td>";
document.getElementById('div6').innerHTML = ac + str + "</td></tr></table>";
}
if (i == 6) {
ac += "<tr><td valign='top' class='style2'><img src='Microsoft.png' height='400px' width='304px'/></td><td>";
document.getElementById('div7').innerHTML = ac + str + "</td></tr></table>";
}
}
function formatDate(tmpDate) {
var t = Date.parse(tmpDate);
// var t = Date.parse("2010-08-13T00:20:45+00:00");
var d = new Date(t);
var weekday = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var month = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var h = d2(d.getHours()); var m = d2(d.getMinutes());
var ampm = "AM";
if (h > 12) {
h = d2(h - 12);
ampm = "PM";
}
var mfDate = weekday[d.getDay()] + ", " + month[d.getMonth()] + " " + tmpDate.substr(5, 2) + ", " + d.getFullYear() + " " + h + ":" + m + " " + ampm;
// alert(mfDate);
return mfDate;
}
function d2(n) {
if (n < 10) return "0" + n;
return n;
}
..............................................................................................
///PHP file
<?php
$q=$_GET["q"];
$j = 0;
$content= "";
$content .= '<table border="2" width="100%"><tr>';
$content .= '<td valign="top" class="style2">';
if($q == "ac"){
$xml=("http://twitter.com/statuses/user_timeline/15224867.rss");
$content.= '<img src="andersoncooper.jpg"/></td><td>';
}
elseif($q == "me"){
$xml=("http://twitter.com/statuses/user_timeline/15224867.rss");
$content.= '<img src="me.png"/></td><td>';
}
elseif($q == "cnn"){
$xml=("http://twitter.com/statuses/user_timeline/759251.rss");
$content.= '<img src="cnn1.jpg"/></td><td>';
}
elseif($q == "yahoo"){
$xml=("http://twitter.com/statuses/user_timeline/19380829.rss");
$content.= '<img src="yahoo.png"/></td><td>';
}
elseif($q == "nelp"){
$xml=("http://twitter.com/statuses/user_timeline/78461452.rss");
$content.= '<img src="nelp-mini.png"/></td><td>';
}
elseif($q == "obama"){
$xml=("http://twitter.com/statuses/user_timeline/813286.rss");
$content.= '<img src="barackobama.jpg"/></td><td>';
}
elseif($q == "ms"){
$xml=("http://twitter.com/statuses/user_timeline/24741685.rss");
$content.= '<img src="Microsoft.png"/></td><td>';
}
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,$xml);
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
$xmlText = new SimpleXmlElement($buffer, LIBXML_NOCDATA);
curl_close($curl_handle);
$cnt = count($xmlText->channel->item);
for($i=0; $i<$cnt; $i++){
$url = $xmlText->channel->item[$i]->link;
$title = $xmlText->channel->item[$i]->title;
$date = $xmlText->channel->item[$i]->pubDate;
$this_date = $date;
$this_ts = strtotime($this_date);
$this_date = strftime("%A, %B %d, %Y %I:%M %p",$this_ts);
$date = ucfirst($this_date);
$content .= 'Atttt <a href="'.$url.'">'.$date.'</a>'.'<br/>'.$title.'<br/><br/>';
}
echo $content."</td></tr></table>";
?>
..........................
HTML file
..............
<!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>
<title>AJAX NON Page Load Demo</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="jquery-1.3.1.min.js" type="text/javascript"></script>
<script src="myJs.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
// alert("Calling Feed");
getFeed();
});
</script>
<link type="text/css" href="css/dot-luv/jquery-ui-1.8.4.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.4.custom.min.js"></script>
<script type="text/javascript">
$(function () {
// Accordion
$("#accordion").accordion({ header: "h3" });
});
</script>
<style type="text/css">
.style1
{
width: 400px;
}
</style>
</head>
<body>
<div id="page-wrap">
<div id="inside">
<div id="header"><table width="100%">
<tr><td align="left" class="style1">
<img src="http://sbctoday.com/wp-content/uploads/2009/05/twitter-logo.png" alt="img" />
</td><td align="right"><h1>Your Daily Twitter Source is ***HERE***</h1>
</td></tr></table>
</div>
<div id="subHeader"><h2><a href="http://twitter.com/andersoncooper">AC</a>
<a href="http://twitter.com/cnn">CNN</a>
<a href="http://twitter.com/cnn">CNN</a>
<a href="http://twitter.com/yahoo">Yahoo!</a>
<a href="http://twitter.com/cnn">Barack Obama</a>
<a href="http://twitter.com/yahoo">Obama</a>
<a href="http://twitter.com/microsoft">NELP</a></h2></div>
<!-- Tabs -->
<!-- Accordion -->
<div id="accordion">
<div>
<h3><a href="#">Reporter Anderson Cooper's Twitts</a></h3>
<div id ="div1"></div>
</div>
<div>
<h3><a href="#"> *** Twitts</a></h3>
<div id ="div2"></div>
</div>
<div>
<h3><a href="#">CNN's Twitts</a></h3>
<div id ="div3"></div>
</div>
<div>
<h3><a href="#">Yahoo!'s Twitts</a></h3>
<div id ="div4"></div>
</div>
<div>
<h3><a href="#">Nelp's Twitts</a></h3>
<div id ="div5"></div>
</div>
<div>
<h3><a href="#">Barack Obama's Twitts</a></h3>
<div id ="div6"></div>
</div>
<div>
<h3><a href="#">Microsoft's Twitts</a></h3>
<div id ="div7"></div>
</div>
</div>
<div style="clear: both;"></div>
<div id="footer"><h3>Information at Footer</h3></div>
</div>
</div>
</body>
</html>
|