<?php
	include('config.php');

	$blog_posts = array(); 

	$sql1 = "SELECT * FROM blog_posts where active = 1 order by eventTime desc limit 8";
	$result1 = mysqli_query($db, $sql1);
	
	$index = 0;
	while ($row1 = mysqli_fetch_array($result1, MYSQLI_BOTH)) {
		
		$blog_post = (object)[];
		$blog_post -> id = $row1['id'];
		$blog_post -> title = $row1['title'];
		$blog_post -> content = $row1['content'];
		$blog_post -> eventTime = $row1['eventTime'];
		$blog_post -> addedTime = $row1['addedTime'];
		$blog_post -> active = $row1['active'];

		$blog_posts[$index++] = $blog_post;

		$sql2 = "SELECT name FROM files_details where blogPost = '" . $blog_post -> id . "' order by mainFile desc limit 1";
		$result2 = mysqli_query($db, $sql2);
		$row2 = mysqli_fetch_array($result2, MYSQLI_ASSOC);
		$count2 = mysqli_num_rows($result2);
		
		if ($count2 > 0) {
			$blog_post -> picture = $row2['name'];
		} else {
			$blog_post -> picture = null;
		}
	}

?>

<!DOCTYPE html>
<html>
<head>
<title>RDDC | Not Found</title>
<!-- for-mobile-apps -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Rough Diamond Day Care was established on the 1 October 2014. As the name says ‘Diamond’ we treat and educate a child as an individual. We develop a child body, mind and character. We believe a child is to be taught to be pure in spite of the sinful world they live in; just as the lily keeps pure even in muddy water.">
<meta name="keywords" content="creche, centurion, olieven, day care, olievenhoutbosch, Rough Diamonds Day Care, christian, sabbath, seven advantist" />
<link rel="canonical" href="http://www.roughdiamonddaycare.co.za/404.php">
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false);
		function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- //for-mobile-apps -->
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<!-- js -->
<link rel="stylesheet" href="css/flexslider.css" type="text/css" media="screen" />
<script src="js/jquery-1.11.1.min.js"></script>
<!-- //js -->
<link href='//fonts.googleapis.com/css?family=Cabin:400,400italic,500,500italic,600,600italic,700,700italic' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Peralta' rel='stylesheet' type='text/css'>
<!-- start-smoth-scrolling -->
<script type="text/javascript" src="js/move-top.js"></script>
<script type="text/javascript" src="js/easing.js"></script>
<script type="text/javascript">
	jQuery(document).ready(function($) {
		$(".scroll").click(function(event){		
			event.preventDefault();
			$('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
		});
	});
</script>
<!-- start-smoth-scrolling -->
</head>
	
<body>
<!-- body -->
	<div class="body-content">
		<div class="container">
			<div class="body-content1">
			<?php
				include('main_header.php');
				include('main_nav.php');?>
			<!-- services -->
				<div class="services">
					<h2>Page not found</h2>
					<div class="services-grids">
						<div class="col-md-8 services-grid">
							<p>The requested url could not be found. The link may be incorrect or the resource may have been deleted or deactivated.</p>
							<div class="clearfix"> </div>
						</div>
						<div class="clearfix"> </div>
					</div>
					<div class="services-grids1">
						<?php foreach ($blog_posts as $blog_post) {?>
						<div class="col-md-3 services-grids1-grid">
							<img src="<?php print isset($blog_post->picture)?'uploads/thumb/'.$blog_post->picture:'images/default_blog_post003.jpg';?>" alt=" " class="img-responsive" />
							<h4><a href="blog_post.php?id=<?php print $blog_post -> id; ?>"><?php print $blog_post -> title; ?></a></h4>
							<p style="text-overflow: ellipsis; word-wrap: break-word; overflow: hidden; max-height: 5.4em; line-height: 1.8em;"><?php print $blog_post -> content; ?></p>
							<div class="more">
								<a href="blog_post.php?id=<?php print $blog_post -> id; ?>" class="hvr-rectangle-out">Read More...</a>
							</div>
						</div>
						<?php }?>
						<div class="clearfix"> </div>
					</div>
				</div>
			<!-- //services -->
			</div>
		</div>
	</div>
<!-- //body -->
<?php include('main_footer.php');?>
<!-- here stars scrolling icon -->
	<script type="text/javascript">
									$(document).ready(function() {
										/*
										var defaults = {
								  			containerID: 'toTop', // fading element id
											containerHoverID: 'toTopHover', // fading element hover id
											scrollSpeed: 1200,
											easingType: 'linear' 
								 		};
										*/
										
										$().UItoTop({ easingType: 'easeOutQuart' });
										
									});
	</script>
<!-- //here ends scrolling icon -->
<!-- for bootstrap working -->
	<script src="js/bootstrap.js"></script>
	<?php include_once("analyticstracking.php") ?>
<!-- //for bootstrap working -->
</body>
</html>
