הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

השב
 
כלים לאשכול תצורת הצגה
ישן 23-11-11, 21:22   # 1
Rockets
חבר בקהילה
 
מיני פרופיל
תאריך הצטרפות: Aug 2006
הודעות: 128

Rockets לא מחובר  

עזרה | קוד jquery

שלום חברים,
יש לי קוד שלוקח נתונים(rss) מאתרים אחרים.
אני רוצה שמכל אתר, הקוד ייקח את מקסימום הפריטים, ויחלק אותם ל-divים, כשבכל דיב- 2 כתבות בלבד.
ובעזרת כפתורים, גולשים יוכלו להעביר קדימה ואחורה כתבות, כשיש כל פעם הסתרה והופעה של דיב אחר.

כרגע הקוד לוקח רק 2 פריטים מכל מקור.

קוד:
	<script type="text/javascript">
		function get_rss_feed() {
			//clear the content in the div for the next feed.
			$("#feedContent").empty();
			
			//use the JQuery get to grab the URL from the selected item, put the results in to an argument for parsing in the inline function called when the feed retrieval is complete
			$.get('proxy.php?url='+$('#diffFeeds').val(), function(d) {
				
				//find each 'item' in the file and parse it

			

		$(d).find('item').each(function(i) {	





					
					//name the current found item this for this particular loop run
					var $item = $(this);
					// grab the post title
					var title = $item.find('title').text();
					// grab the post's URL
					var link = $item.find('link').text();
					// next, the description
					var description = $item.find('description').text();
					//don't forget the pubdate
					var pubDate = $item.find('pubDate').text();
					
					// now create a var 'html' to store the markup we're using to output the feed to the browser window
					var html = "<div class=\"entry\"><h2 class=\"postTitle\">" + title + "<\/h2>";
					html += "<em class=\"date\">" + pubDate + "</em>";
					html += "<p class=\"description\">" + description + "</p>";
					html += "<a href=\"" + link + "\" target=\"_blank\">Read More >><\/a><\/div>";
					
					//put that feed content on the screen!
					$('#feedContent').append($(html));  
return (i<1);  

				});
			});
			
		};
		
	</script>
</head>
<body>
<div id="container">
<div id="ui">
<h1>Flash Feed Reader</h1>
<form id="selectParser" action="">
<label>Select a feed:</label>
<select id="diffFeeds" onchange="get_rss_feed();">
	<option value="">Select</option>
	<option value="http://rss.walla.co.il/?w=/1/0/1/@rss">walla</option>
	<option value="http://www.bit-101.com/blog/?feed=rss2">Bit-101</option>
	<option value="http://feeds.feedburner.com/peterelst/">Peter Elst</option>
	<option value="http://www.gskinner.com/blog/index.xml">Grant Skinner</option>
	
</select>
</form>
יש למישהו רעיון?

Last edited by IgalSt; 23-11-11 at 23:18..
  Reply With Quote
ישן 23-11-11, 23:20   # 2
IgalSt
מנהל פורום, עסק רשום
 
IgalSt's Avatar
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
מיקום: המרכז
גיל: 38
הודעות: 1,432
Send a message via Skype™ to IgalSt

IgalSt לא מחובר  

לדעתי הבעיה היא ב-proxy.php
הקוד שלך מכניס את כל הפריטים שהוא מקבל. יש לך שם לולאת for each.
  Reply With Quote
ישן 27-11-11, 10:12   # 3
AlmogBaku
חבר וותיק
 
AlmogBaku's Avatar
 
מיני פרופיל
תאריך הצטרפות: Nov 2007
מיקום: מודיעין
הודעות: 1,022

AlmogBaku לא מחובר  

בוא נתחיל מזה שכדאי מאוד מאוד מאוד שתשלח את כל המידע הזה בPOST ושמאגר הכתובות הניתנות לגלישה יהיה מתוך whitelist וישלח ע"י "קוד אתר". אחרת אתה תהיה מועד לפורענות של האקרים.
דבר שני- האם באמת בדקת את קובץ ה proxy?
וכמובן תבצע דיבאגינג על הקוד שלך עם console.log ועם פיירבאג.
  Reply With Quote
ישן 07-12-11, 19:44   # 4
Rockets
חבר בקהילה
 
מיני פרופיל
תאריך הצטרפות: Aug 2006
הודעות: 128

Rockets לא מחובר  

הצלחתי לבצע מה שרציתי
baku אשמח אם תפרט כיצד לעשות שמאגר הכתובות הניתנות לגלישה יהיה מתוך whitelist וישלח ע"י "קוד אתר".
  Reply With Quote
השב

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 21:32.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ