Advertisement
eladha

last 10 news in php html Marquee

Dec 13th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.51 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html dir="rtl">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>index</title>
  6.     <link rel="stylesheet" href="css/font-awesome.min.css" />
  7.     <style>
  8.         .marquee{
  9.             border: 2px solid rgba(172, 204, 214, 0.33);
  10.             padding-right: 20px;
  11.             border-radius: 10px;
  12.             padding-top: 10px;
  13.             height: 30px;
  14.             margin-top: 10px;
  15.             font-size: 16px;
  16.             font-weight: bold;
  17.             font-family: tahoma;
  18.         }
  19.         .marquee a{
  20.             text-decoration: none;
  21.             color:rgba(121,201,215,.6);
  22.         }
  23.         .marquee a i{
  24.             color:rgba(225,60,0,.5);
  25.         }
  26.         .last-news{
  27.             color: #f60;
  28.             padding-right: 20px;
  29.             height: 30px;
  30.             margin-top: 10px;
  31.             font-size: 16px;
  32.             font-weight: bold;
  33.             font-family: tahoma;
  34.         }
  35.     </style>
  36.    
  37. </head>
  38. <body>
  39.  
  40. <!-- بداية marquee -->
  41.  
  42. <header>
  43. <span class="last-news">اخر الأخبار :</span>
  44. <span class="claer"></span>
  45. <span class="marquee">
  46. <marquee width="800px" onmouseover="stop();" onmouseout="start();" behavior="scroll" direction="left">
  47.      
  48.       <?php
  49.             // سكربت الاتصال وجلب البيانات
  50.            
  51.               $connect = new mysqli("localhost","root","root","blogger"); // دالة الاتصال بالسيرفر المحلي وقاعدة البيانات
  52.               /*
  53.               localhost = السيرفر المحلي
  54.               root = اليوزر الخاص بالسيرفر المحلي
  55.               root = الباسوورد الخاص بالسيرفر المحلي
  56.               blogger = اسم قاعدة البيانات
  57.               */
  58.              
  59.               /*
  60.               شرط التحقق من الاتصال ان كان متاح او لا
  61.               في حال عدم وجود اتصال يقوم بقتل العملية ويخرج رسالة
  62.               */
  63.               if($connect->connect_error){
  64.                 die("Error conect:".$connect->connect_error);
  65.                 }
  66.               /*
  67.               بداية جلب البيانات من الجدول news وتحديد عدد المعلومات المخرجة في اخر 10 معلومات فقط
  68.               */
  69.               $query = $connect->query('select * from news order by id desc limit 10 ');
  70.              
  71.               // عمل دوران لجلب اخر المواضيع المخزنة في قاعدة البيانات
  72.              // ملاحظة مهمة جداا غير هذه الصفحة marquee.php برابط صفحة اظهار المواضيع لديك
  73.               while($rows = $query->fetch_object()){
  74.               echo'&nbsp;'.'<a href="marquee.php?id='.$rows->id.'"><i class="fa fa-arrow-circle-left"></i> '.$rows->title.' </a>';
  75.               }
  76.       ?>
  77.      
  78.       <!-- نهاية سكربت الاتصال وجلب البيانات -->
  79.      
  80. </marquee>
  81. </span>
  82. </header>
  83.  
  84. <!-- نهاية marquee -->
  85.  
  86. </body>
  87. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement