<?php
$this->load->view("top_application");
$fieldType = $this->session->userdata('field_type');
?>
<section class="dir-alp dir-pa-sp-top">
  <div class="container">
    <div class="row">
      <div class="pg-list-1-left1"> <h1><?php echo $res['article_title' . $fieldType]; ?></h1>
        <div class="dir-alp-tit">
          <ol class="breadcrumb">
            <li><a href="<?php echo site_url(); ?>" title="Return to Home">Home</a></li>
            <li><a href="<?php echo site_url(); ?>blog" title="Blogs">Blogs</a></li>
            <li class='active'><?php echo $res['article_title' . $fieldType]; ?></li>       
          </ol>
        </div>
      </div>
    </div>
  </div>

  <div class="container">
    <div class="row">
      <div class="dir-alp-con">
        <div class="col-md-9 dir-alp-con-right list-grid-rig-pad left_right_pad blog_left_pad">

          <div class="blog-post">
          <!--<h2><?php echo $res['article_title' . $fieldType]; ?></h2>-->
            <ul class="list-inline">
              <li><i class="fa fa-user"></i> By: <?php echo $res['blog_author']; ?> | </li>
              <li><i class="fa fa-calendar"></i> <?php echo getDateFormat($res['post_date'],3); ?> | </li>
              <li><i class="fa fa-comments"></i> <?php echo count($comm); ?> Comments</li>
            </ul>
            <div class="fullimage">
              <img class="img-responsive" src="<?php echo get_image('blog', $res['article_image'], '', '', 'R'); ?>" title="<?php echo $res['article_title' . $fieldType]; ?>" alt="<?php echo $res['article_title' . $fieldType]; ?>">
            </div>

            <?php echo $res['article_desc' . $fieldType]; ?>

            <!-- blog Detail -->
            <?php
            if (is_array($comm) && !empty($comm)) {
              ?>
              <!-- Comments Holder -->
              <div class="comments-holder">

                <!-- Secondary heading -->
                <div class="sec-heading">
                  <h3><?php echo ($this->session->userdata('lang') == 'p') ? $this->lang->line('people_comment') : 'People Comments'; ?></h3>
                </div>
                <!-- Secondary heading -->          
                                    
                                    
                <!-- Comments -->
                <ul>
                  <?php
                  foreach ($comm as $bval) {
                    ?>
                    <li style="list-style-type: none;">
                      <div class="comment">
                        <div class="row">
                          <div class="col-md-1">
                            <img class="" src="<?php echo theme_url(); ?>images/blog/user.jpg" alt="">
                          </div>
                          <div class="col-md-11">
                            <h6>Posted By: <?php echo $bval['mem_name']; ?> on <span><?php echo getDateFormat($bval['post_date'], 6); ?></span></h6>
                            <p><?php echo $bval['comment']; ?></p>
                          </div>
                        </div>
                      </div>
                    </li>

                    <?php
                  }
                  ?>
                </ul>
                <!-- Comments -->

              </div>
              <!-- Comments Holder -->
              <?php
            }
            ?>
            <!-- Form -->
            <div class="form-holder">
              <a name="post_comment"></a>
              <!-- Secondary heading -->
              <div class="sec-heading">
                <h3><?php echo ($this->session->userdata('lang') == 'p') ? $this->lang->line('leave_comment') : 'Leave Comments'; ?></h3>
              </div>
              <!-- Secondary heading -->

              <!-- Sending Form -->
              <form class="sending-form"action="<?php echo current_url(); ?>#post_comment" method="post">
                <?php echo validation_message(); ?>
                <?php echo error_message(); ?>
                <div class="row">
                  <div class="col-sm-12">
                    <div class="form-group">
                      <textarea class="form-control" required="required" name="comment" rows="2" placeholder="Your Comment here..."><?php echo set_value('comment'); ?></textarea>
                    </div>
                  </div>
                  <div class="col-sm-6">
                    <div class="form-group">
                      <input class="form-control" required="required" name="name" value="<?php echo set_value('name'); ?>" placeholder="Your Name">

                    </div>
                  </div>
                  <div class="col-sm-6">
                    <div class="form-group">
                      <input class="form-control" required="required" type="email" name="email" value="<?php echo set_value('email'); ?>" placeholder="Your Email">

                    </div>
                  </div>
                  <div class="col-sm-12">
                    <button class="button" type="submit"><?php echo ($this->session->userdata('lang') == 'p') ? $this->lang->line('send_message') : 'send message'; ?></button>
                    <input type="hidden" name="action" value="post_comment" />
                  </div>
                </div>
              </form>
              <!-- Sending Form -->
            </div>
            <!-- Form -->
          </div>

        </div>

        <div class="col-md-3 dir-alp-con-left">
          <div class="dir-alp-l3 dir-alp-l-com">
            <h4><?php echo ($this->session->userdata('lang') == 'p') ? $this->lang->line('categories') : 'Category'; ?></h4>
            <div class="dir-hom-pre dir-alp-left-ner-notb">
              <ul>
                <?php
                $resGro = $this->db->query("SELECT * FROM wps_categories WHERE status = '1' AND parent_id = '0'")->result_array();
                foreach ($resGro as $sideval) {
                  ?>
                  <li><a href="<?php echo site_url($sideval['friendly_url']); ?>" title="<?php echo $sideval['category_name' . $fieldType]; ?>"> <?php echo $sideval['category_name' . $fieldType]; ?></a></li>
                  <?php
                }
                ?>
              </ul>

              <div class="dir-alp-l3 dir-alp-l-com">
                <h4><?php echo ($this->session->userdata('lang') == 'p') ? $this->lang->line('similar_blogs') : 'Similar Blogs'; ?></h4>
                <div class="dir-alp-l-com1 dir-alp-p3 you_may_like">
                  <?php
                  $popular = $this->db->query("SELECT * FROM wps_blog WHERE article_id ORDER BY rand() LIMIT 20")->result_array();
                  foreach ($popular as $popular) {
                    ?>
                    <div class="right_news">
                      <a href="<?php echo site_url($popular['friendly_url']); ?>">
                        <div class="image">
                          <img class="img-responsive" src="<?php echo get_image('blog', $popular['article_image'], '', '', 'R'); ?>" alt="">
                        </div>
                      </a>
                      <h5><a href="<?php echo site_url($popular['friendly_url']); ?>"><?php echo $popular['article_title']; ?></a></h5>
                      <!--<ul class="list-inline">
                      <li><i class="fa fa-user"></i> By: <?php echo $popular['blog_author']; ?> | </li>
                      <li><i class="fa fa-calendar"></i> <?php echo $popular['post_date']; ?></li>
                      </ul>
                      <p><?php echo $popular['short_desc']; ?></p>-->
                    </div>
                    <?php
                  }
                  ?>               
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>
<!-- ============================================================= FOOTER ============================================================= -->
<?php $this->load->view("bottom_application"); ?>
