Zend_Feed-Introduction.xml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <sect1 id="zend.feed.introduction">
  2. <title>הקדמה</title>
  3. <para>
  4. <code>Zend_Feed</code> מספק פונקציונליות לצריכת סנדקציה של RSS ו Atom. היא מספקת תחביר טבעי לגישה לאלמנטים בתוך הסנדקציה, ערכי סנדקציה, וערכי ערכים מסויימים.
  5. <code>Zend_Feed</code> מאפשר תמיכה רחבה לעריכה של מבנה הסנדקציה והערכים עם אותו התחביר הטבעי, והמרת התוצאה בחזרה ל XML.
  6. </para>
  7. <para>
  8. טכנית, <code>Zend_Feed</code> מכיל מחלקת בסיס <code>Zend_Feed</code>, מחלקות לא מוחשיות <code>Zend_Feed_Abstract</code> ו <code>Zend_Feed_Entry_Abstract</code>
  9. אשר מייצגים סנדצקיות ורשומות, הטמעות ספצפיות לסנדצקיות של RSS ו Atom, ותוספי עזרה אשר עושים את העבודה מאחורי הקלעים.
  10. </para>
  11. <para>
  12. בדוגמא למטה, אנחנו מדגימים שימוש פשוט בקבלת סנדקצית RSS ושמירה של חלק ממנה אל מערך ב PHP, שלאחר מכן יהיה ניתן להדפיסו, שמירה במסד הנתונים וכדומה.
  13. </para>
  14. <note>
  15. <title>תהיו מודעים</title>
  16. <para>
  17. סנדצקיות רבות מכילות ערוצים שונים וערכים שונים. המפרט של RSS מספק הרבה ערכים אופציונלים, אז יש להיות מודעים על כך ברגע שכותבים קוד אשר יעבוד עם תוכן RSS.
  18. </para>
  19. </note>
  20. <example id="zend.feed.introduction.example.rss">
  21. <title>שימוש ב <code>Zend_Feed</code> על מידע מ RSS</title>
  22. <programlisting role="php"><![CDATA[
  23. // Fetch the latest Slashdot headlines
  24. try {
  25. $slashdotRss =
  26. Zend_Feed::import('http://rss.slashdot.org/Slashdot/slashdot');
  27. } catch (Zend_Feed_Exception $e) {
  28. // feed import failed
  29. echo "Exception caught importing feed: {$e->getMessage()}\n";
  30. exit;
  31. }
  32. // Initialize the channel data array
  33. $channel = array(
  34. 'title' => $slashdotRss->title(),
  35. 'link' => $slashdotRss->link(),
  36. 'description' => $slashdotRss->description(),
  37. 'items' => array()
  38. );
  39. // Loop over each channel item and store relevant data
  40. foreach ($slashdotRss as $item) {
  41. $channel['items'][] = array(
  42. 'title' => $item->title(),
  43. 'link' => $item->link(),
  44. 'description' => $item->description()
  45. );
  46. }
  47. ]]>
  48. </programlisting>
  49. </example>
  50. </sect1>
  51. <!--
  52. vim:se ts=4 sw=4 et:
  53. -->