Advertisement
Guest User

Untitled

a guest
Jan 13th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.74 KB | None | 0 0
  1. <html>
  2.     <head>
  3.         <script src="https://conpromo.ru/web/js/jquery-1.11.3.min.js"></script>
  4.     </head>
  5.     <body>
  6.         <div style='text-align: center; font-size: 70px; width: 40%; margin-top: 10px; margin-bottom: 30px; margin-left: 30%; margin-right: 30%; border-radius: 5px'>
  7.             События
  8.         </div>
  9.         <?php
  10.             $host = 'ra-ms.ru';
  11.             $user = 'u0018_me';
  12.             $pass = '545537';
  13.             $db = 'u0018154_my_db';
  14.  
  15.             include 'safemysql.class.php';
  16.  
  17.             $db = new SafeMysql(array('host' => $host, 'user' => $user, 'pass' => $pass, 'db' => $db, 'charset' => 'UTF8'));
  18.  
  19.             $events = $db -> getAll("SELECT * FROM events ORDER BY event_date");
  20.            
  21.             for($i = 0; $i < count($events); $i++){
  22.                 echo "<div id='event" .$i. "' style='border: 1px black solid; opacity: 0; width: 40%; margin-top: 10px; margin-left: 30%; margin-right: 30%; background: rgb(230, 230, 230); border-radius: 5px; padding: 5px'>";
  23.                 $curr_date = $events[$i]["event_date"];
  24.                 $dj = ($db -> getCol("SELECT `dj_alias` FROM `djs` WHERE `date` = ?s", $curr_date));
  25.                 $dj = $dj[0];
  26.                 echo    '<div style="font-size: 30px">' . $events[$i]["title"] . '</div>'.
  27.                         '<div style="font-size: 20px">' . $curr_date . '</div>'.
  28.                         '<div style="font-size: 20px">' . (count($dj) > 0 ? "Диджей: ".$dj : "") . '</div>'.
  29.                         '<div style="font-size: 20px">' . $events[$i]["description"] . '</div>';
  30.                 echo '</div>'; 
  31.             }
  32.         ?>
  33.        
  34.         <script type="text/javascript">
  35.             function animate_event(id_num) {
  36.                 setTimeout(function() {
  37.                     id = "#event" + id_num;
  38.                     $(id).animate({opacity:'1'}, 1000)
  39.                 }, id_num * 500);
  40.             }
  41.             $(document).ready(function() {
  42.                 for(var i = 0; i < <?php echo count($events)?>; i++){
  43.                     animate_event(i);
  44.                 }
  45.             });
  46.         </script>
  47.     </body>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement