<?php
include 'header.php';
?>
	
	
	
	<!-- Page Title -->
    <section class="page-title">
		<div class="color-one"></div>
		<div class="color-two"></div>
		<div class="color-three"></div>
		<div class="color-four"></div>
        <div class="auto-container">
			<h2>Our Events</h2>
			<ul class="bread-crumb clearfix">
				<li><a href="index.php"><i class="flaticon-home"></i> OIPS</a></li>
				<li>Our Events</li>
			</ul>
        </div>
		<!--Waves Container-->
        <div>
          <svg class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
          viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto">
          <defs>
          <path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z" />
          </defs>
          <g class="parallaxx">
          <use xlink:href="#gentle-wave" x="148" y="0" fill="rgba(255,255,255,0.7" />
          <use xlink:href="#gentle-wave" x="100" y="3" fill="rgba(255,255,255,0.5)" />
          <use xlink:href="#gentle-wave" x="70" y="5" fill="rgba(255,255,255,0.3)" />
          <use xlink:href="#gentle-wave" x="48" y="7" fill="#fff" />
          </g>
          </svg>
        </div>
        <!--Waves end-->
    </section>
    <!-- End Page Title -->
	

<!-- Blog One / Style Two -->
<section class="blog-one style-two bg-white">
	<div class="auto-container">
		<!-- Sec Title -->
		<div class="sec-title style-three">
			<div class="d-flex justify-content-between align-items-end flex-wrap">
				<div class="left-box">
					<div class="sec-title_title">Read Our Events</div>
					<h2 class="sec-title_heading">Exciting Events &    <br> Activities at <span>OIPS</span></h2>
				</div>
				<!-- <div class="team-two_button">
					<a href="events.php" class="theme-btn btn-style-one">
						<span class="btn-wrap">
							<span class="text-one">More Events <i class="flaticon-next-1"></i></span>
							<span class="text-two">More Events <i class="flaticon-next-1"></i></span>
						</span>
					</a>
				</div> -->
			</div>
		</div>
		<div class="row clearfix">
			
			<?php
	           $query = $conn->prepare("SELECT * FROM events order by id desc limit 3");
	           $query->execute();
	           $events_result = $query->fetchAll();
	           $events_row = count($events_result); 
	           if($events_row>0) {
	             foreach ($events_result as $value) {
	                $title = $value['title'];
	                $url = $value['url'];
	                $description = $value['description'];
	                $created_at = date_create($value['created_at']);            
            ?>
							<div class="news-block_one col-lg-4 col-md-6 col-sm-12">
								<div class="news-block_one-inner wow fadeInLeft" data-wow-delay="0ms" data-wow-duration="1500ms">
									<div class="news-block_one-image">
										<a href="event-details.php?url=<?php echo  $url; ?>"><img src="bb-admin/upload/events/<?php echo $value['feature_img'] ?>" style="width:100%;height:120px;object-fit:cover;object-position: top center;"/></a>
									</div>
									<div class="news-block_one-content">
										<ul class="news-block_one-meta">
											<li>Oriental International Public School</li>
											<li><?php echo date_format($created_at,"d"); ?> <?php echo date_format($created_at,"M"); ?>, <?php echo date_format($created_at,"Y"); ?></li>
										</ul>
										<h4 class="news-block_one-title"><a href="event-details.php?url=<?php echo  $url; ?>"><?php if(!empty($title)){echo $title; } ?></a></h4>
										<a class="news-block_one-more" href="event-details.php?url=<?php echo  $url; ?>">Read More <i class="flaticon-next-1"></i></a>
									</div>
								</div>
							</div>
							<?php
                  }
               }else{
                     echo "<h2>No data available...</h2>";
                  }
               ?>
			
			
		</div>
	</div>
</section>
<!-- End Blog One / Style Two -->
	


<?php
include 'footer.php';
?>
	