<?php
require_once("blog.php"); ?>
<!DOCTYPE html>
<html lang="en">

<head>
    <script type="text/javascript">
        function SearchBlogs() {
            //frmNews.txtAction.value = "search_news";
            frmBlogs.submit();
        }
    </script>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Blogs – Asian College of Teachers</title>

    <style type="text/css">
        .article-block-in {
            padding: 10px 20px;
            margin: 10px 0px;
            border-bottom: 1px dashed #666;
        }

        .news-dt {
            color: #dd4415;
            font-weight: bold;
            font-family: "Open sans";
        }

        .head_gry_sm2 {
            font-size: 20px !important;
            color: #1e1e1e;
            text-transform: capitalize;
        }

        .article-block-in p {
            font-size: 15px !important;
            line-height: 20px;
            padding: 5px 0px 5px 0;
            margin: 0;
            text-align: justify;
        }

        .readmore-3 a {
            color: #f25526;
            background: url(images/read-more.png) no-repeat right top;
            padding: 11px 21px;
            width: 110px;
            height: 39px;
            text-indent: -5;
        }

        .readmore-3 a:hover {
            color: #f25526;
            background: url(images/read-more-hover.png) no-repeat right top;
            padding: 11px 21px;
            width: 110px;
            height: 39px;
            text-indent: -5;
        }
    </style>
    <link rel="stylesheet" href="css/paginate.css" type="text/css">
    <?php include('common/script.php'); ?>
</head><!--/head-->

<body>


    <?php include('common/header.php'); ?>
    <section class="inner-banner-sec">
        <div class="banner-overlay">
            <div class="container text-center">
                <h1>Blog</h1>
                <ul class="breadcrumb">
                    <li><a href="./">Home</a></li>
                    <li class="active">Blog</li>
                </ul>
            </div>
        </div>
    </section>

    <!-- Blog Section -->
    <section id="blog-section" class="blog-wrapper container py-5 mt-5">
        <div class="row">
            <!-- Main Content -->
            <div class="col-lg-8">

                <?php for ($i = 0; $i < $no_of_blogs; $i++) {
                    $blog_title_org[$i] = $blog_title[$i];
                    $slug = strtolower(preg_replace('/[^A-Za-z0-9-]+/', '-', $blog_title[$i]));
                    $url = "{$blog_id[$i]}-$slug-blog.php";
                    $text = strip_tags($blog_pre_desc[$i] != "" ? $blog_pre_desc[$i] : $blog_desc[$i]);
                ?>
                    <div class="blog-card mb-4 d-flex shadow-sm rounded-4 overflow-hidden">
                        <?php if (!empty($blog_image_path[$i])) { ?>
                            <div class="blog-img">
                                <img src="https://www.teachertrainingasia.com/admin_tta/blog_image/<?php echo basename($blog_image_path[$i]); ?>" alt="Blog Image" class="img-fluid">
                            </div>
                        <?php } ?>
                        <div class="blog-content p-4">
                            <h5 class="blog-title"><?php echo $blog_title_org[$i]; ?></h5>
                            <p class="blog-date"><i class="fa fa-calendar me-2"></i> <?php echo date('jS F Y', strtotime($posting_dt[$i])); ?></p>
                            <p class="blog-snippet"><?php echo substr($text, 0, 200); ?>...</p>
                            <?php if ($written_by[$i]) { ?>
                                <p class="blog-author"><strong>Written By:</strong> <?php echo $written_by[$i]; ?></p>
                            <?php } ?>
                            <div class="blog-row">
                                <div class="blog-col">
                                    <div class="social-icons">
                                        <a href="http://www.facebook.com/sharer.php?u=https://www.teachingqualification.com/blog/<?php echo $url; ?>" target="_blank"><i class="fa fa-facebook"></i></a>
                                        <a href="https://www.linkedin.com/sharing/share-offsite/?url=https://www.teachingqualification.com/blog/<?php echo $url; ?>" target="_blank"><i class="fa fa-linkedin"></i></a>
                                        <a href="whatsapp://send?text=https://www.teachingqualification.com/blog/<?php echo $url; ?>" target="_blank"><i class="fa fa-whatsapp"></i></a>
                                    </div>
                                </div>
                                <div class="blog-col">
                                    <a href="<?php echo $url; ?>" class="btn-read">Read More</a>
                                </div>
                            </div>

                        </div>
                    </div>
                <?php } ?>
                <!--PAGINATION START-->
        	<div class="paginate wrapper"><!-- The "wrapper" is just a comestic addition. You don't need this for the pagination to work. -->
                <ul>
                    <li><a href="page-1.php">First</a></li>
                    <li><a <?php if($page == 1) { ?>href="page-<?php echo $page; ?>.php" <?php } else { ?> href="page-<?php echo $page-1; ?>.php" <?php } ?>>Prev</a></li>
                    
                    <?php  for ($x=$s; $x<=$e; $x++) {  //echo $page; echo $i; ?>
                    <li><a <?php if($page == $x) { ?> class="active" <?php } else { ?> class="inactive" <?php } ?> href="page-<?php echo $x; ?>.php" ><?php echo $x; ?></a></li>
                    <?php  }  ?>
                    
                    <!--<li><a href="" class="more">&hellip;</a></li>-->
                    <li><a <?php if($page == $total_pages) { ?>href="page-<?php echo $total_pages; ?>.php" <?php } else { ?> href="page-<?php echo $page+1; ?>.php" <?php } ?>>Next</a></li>
                    <li><a href="page-<?php echo $total_pages; ?>.php">Last</a></li>
                </ul>
            </div>
            
            <!--PAGINATION END-->
            </div>

            <!-- Sidebar -->
            <?php include('common/blogs-rightpanel.php'); ?>
        </div>
    </section>




    <?php include('common/footer.php'); ?>


</body>

</html>