النتائج 1 إلى 3 من 3

الموضوع: [طلب] كود بسيط: لعرض rss feeds

  1. #1

    [طلب] كود بسيط: لعرض rss feeds



    السلام عليكم ورحمة الله وبركاته ..

    أحتاج كود بأي لغة javascript/php/html أو أيًا كانت تكون ..

    فقط لعرض قائمة بآخر المواضيع من صفحة rss feed

    مثلًا أضع رابط التغذية الخاص بمنتداي external.php?type=rss2

    ويتم عرض آخر المدخلات بهذه الصفحة على شكل قائمة

    يمكن وضعها في سكربت عادي

    مثال :



    أرجو أن يكون الكود مرن وقابل للتعديل مثلًا لتحديد عدد المواضيع المعروضة .. وأن يقبل أي صفحة تغذية سواءً كانت لسكربت منتدى أو غيره..

    و أرجو أن يكون طلبي واضحًا ..

    للعلم جربت كلاس اسمه lastRSS 0.9.1

    لكن النتيجة كانت دائمًا : Error: It's not possible to reach RSS file...





    التعديل الأخير تم بواسطة Abdulrahman Hassoun ; 01-12-2011 الساعة 06:43 PM


  2. #2
    عضو فعال جدا
    تاريخ التسجيل
    Apr 2002
    المشاركات
    2,046


    استخدم الكلاس rssreader
    للتحميل: http://apptools.com/phptools/downloads/rssreader.zip

    مثال:
    كود PHP:
    <?php
       
    // Include the file that does all the work
       
    include("rssreader.php");

       
    // This is the URL to the actual RSS feed. Change this value
       // if you want to show a different feed.
       
    $url="http://news.yahoo.com/rss/";

       
    // Create an instance of the rssFeed object, passing it
       // the URL of the feed
       
    $rss=new rssFeed($url);

       
    // If there was an error getting the data
       
    if($rss->error){
          
    // Show the error
          
    print "<h1>Error:</h1>\n<p><strong>$rss->error</strong></p>";
       }else{

          
    // Otherwise, we have the data, so we call the parse method
          
    $rss->parse();

          
    // The showHeading can accept a paramater that will be used
          // as the tag to wrap the heading. In this case, we're wrapping
          // the title in an <h1> tag
          
    $rss->showHeading("h1");

          
    // Display the image if there is one
          
    $rss->showImage("left");
          
          
    $rss->maxstories=10;

          
    // If the RSS feed provides a link
          
    if($rss->link){
             
    // Display it
             
    print "<p>Provided courtesy of:<br>\n";
             
    $rss->showLink();
          }

          
    // Display the description
          
    $rss->showDescription();

          
    // Show the news stories
          
    $rss->showStories();
       }
    ?>
    كما يمكنك التحكم في عدد العناوين المعروضة عن طريق تغيير القيمة هنا:
    كود PHP:

          $rss
    ->maxstories=10






    __________________
    مدونتي

  3. #3


    استخدم الكلاس rssreader
    للتحميل: http://apptools.com/phptools/downloads/rssreader.zip

    مثال:
    كود PHP:
    <?php
       
    // Include the file that does all the work
       
    include("rssreader.php");

       
    // This is the URL to the actual RSS feed. Change this value
       // if you want to show a different feed.
       
    $url="http://news.yahoo.com/rss/";

       
    // Create an instance of the rssFeed object, passing it
       // the URL of the feed
       
    $rss=new rssFeed($url);

       
    // If there was an error getting the data
       
    if($rss->error){
          
    // Show the error
          
    print "<h1>Error:</h1>\n<p><strong>$rss->error</strong></p>";
       }else{

          
    // Otherwise, we have the data, so we call the parse method
          
    $rss->parse();

          
    // The showHeading can accept a paramater that will be used
          // as the tag to wrap the heading. In this case, we're wrapping
          // the title in an <h1> tag
          
    $rss->showHeading("h1");

          
    // Display the image if there is one
          
    $rss->showImage("left");
          
          
    $rss->maxstories=10;

          
    // If the RSS feed provides a link
          
    if($rss->link){
             
    // Display it
             
    print "<p>Provided courtesy of:<br>\n";
             
    $rss->showLink();
          }

          
    // Display the description
          
    $rss->showDescription();

          
    // Show the news stories
          
    $rss->showStories();
       }
    ?>
    كما يمكنك التحكم في عدد العناوين المعروضة عن طريق تغيير القيمة هنا:
    كود PHP:

          $rss
    ->maxstories=10
    تمااااام ..

    جربته.. وهو المطلوب تمامًا .. ويعمل بكفاائة

    لكني لاحظت إن الكود مكتوب من 2005 يمكن يكون له تحديثات أو تحسينات؟

    وجزاك الله كل خير على الكلاس ^^










ضوابط المشاركة

  • لا تستطيع إضافة مواضيع جديدة
  • لا تستطيع الرد على المواضيع
  • لا تستطيع إرفاق ملفات
  • لا تستطيع تعديل مشاركاتك
  •  

أضف موقعك هنا| اخبار السيارات | حراج | شقق للايجار في الكويت | بيوت للبيع في الكويت | دليل الكويت العقاري | مقروء | شركة كشف تسربات المياه | شركة عزل اسطح بالرياض | عزل فوم بالرياض| عزل اسطح بالرياض | كشف تسربات المياة بالرياض | شركة عزل اسطح بالرياض