<?php
$this->load->view("top");
$popular = $this->db->query("SELECT * FROM wps_blog WHERE article_id ORDER BY rand() LIMIT 20")->result_array();
?>
<section class="banner_category" style="background-image: url('<?php echo theme_url(); ?>images/listing-banner.jpg');">
    <div class="container">

        <h1 class="banner_title"><?php echo $res['article_title']; ?></h1>
    </div>
</section>
<div class="page_breadcrumbs">
        <div class="container">
            <ul>
            <li><a href="<?php echo site_url(); ?>" title="Home">Home</a></li>
      <li><a href="<?php echo site_url(); ?>blog" title="Blog">Blog</a></li>
      <li><?php echo $res['article_title']; ?></li>
				
            </ul>
        </div>
    </div>



 <section class="blog_page webpulse_tm_universal_title_holder">
  <div class="container">
    <div class="row">
      <div class="col-md-9">
       <div class="title_holder_inner">
       <h1 class="left_title1"><?php echo $res['article_title']; ?></h1>
          </div>
        <div class="blog_left blog_details">
          
          <ul>
            <li><i class="fa fa-user"></i> <?php echo $res['blog_author']; ?></li>
            <li><i class="fa fa-clock-o"></i> <?php echo getDateFormat($res['post_date'], 3); ?> </a></li>
          </ul>
          <div class="blog_details1">
            <div class="details_image">
              <img src="<?php echo get_image_with_name($res['article_title'],'blog', $res['article_image'], '850', '850', 'R'); ?>" alt="<?php echo $res['article_title']; ?>" title="<?php echo $res['article_title']; ?>">
            </div>
            <?php echo $res['article_desc']; ?>     
			</div>
        </div>
      </div>

      <div class="col-md-3">
        <div class="left_sidebar">
                      <div class="left_title1">Popular Post</div>
					  
			 <?php
              foreach ($popular as $popular) {
                ?>
                 <div class="right_news">
					<a href="<?php echo site_url($popular['friendly_url']); ?>">
					  <div class="image">
						<img src="<?php echo get_image_with_name($popular['article_title'], 'blog', $popular['article_image'], '382', '213', 'R'); ?>" alt="<?php echo $popular['article_title']; ?>" title="<?php echo $popular['article_title']; ?>">
					  </div>
					</a>
					<h5><a href="<?php echo site_url($popular['friendly_url']); ?>"><?php echo $popular['article_title']; ?></a></h5>
				  </div>
                <?php } ?>          
          </div>
      </div>
    </div>
  </div>
</section> 


  
<?php $this->load->view("bottom"); ?>
<script type="text/javascript">
   window.onload = setShareLinks;

    function setShareLinks() {
        var pageUrl = encodeURIComponent(document.URL);
        var description = document.querySelector("meta[name='description']").getAttribute("content");
        var description = encodeURIComponent(description);

        elements = document.querySelectorAll(".social-share.facebook");
        Array.prototype.forEach.call(elements, function(el) {
            el.addEventListener("click", function() {
                url = "https://www.facebook.com/sharer.php?u=" + pageUrl;
                socialWindow(url);
            });
        });

        elements = document.querySelectorAll(".social-share.twitter");
        Array.prototype.forEach.call(elements, function(el) {
            el.addEventListener("click", function() {
                url = "https://twitter.com/intent/tweet?url=" + pageUrl + "&text=" + description;
                socialWindow(url);
            });
        });

        elements = document.querySelectorAll(".social-share.linkedin");
        Array.prototype.forEach.call(elements, function(el) {
            el.addEventListener("click", function() {
                url = "https://www.linkedin.com/shareArticle?mini=true&url=" + pageUrl;
                socialWindow(url);
            });
        });
    };

    function socialWindow(url) {
        var left = (screen.width - 570) / 2;
        var top = (screen.height - 570) / 2;
        var params = "menubar=no,toolbar=no,status=no,width=570,height=570,top=" + top + ",left=" + left;
        window.open(url, "NewWindow", params);
    };
</script>