<?php get_header(); ?>

<body>

<div class="frontLayer onDesktop"> 

  <section class="row-fluid" id="mainContainer">

    <div class="span10 content borBox pull-right">

      <div class="row-fluid phone_banner">

<?php include('banner.php'); ?>

<?php include('login.php'); ?>

</div>

          <div class="nav_links row-fluid ">

            <div class="span8">

<?php include('topnav.php'); ?>

            </div>

            <div class="span4">

			

			<?php include('searchform.php'); ?>



	        </div>

          </div>

    <div class="row-fluid">

      <div class="span8 krContent">

	<?php if (have_posts()) :  while (have_posts()) : the_post(); ?> 

<div class="row-fluid blogPost us-startups xkr">

<div class="indeximg">

<?php $thumb = getFirstImage($post->ID);

if(strlen($thumb) > 0) {

 echo $thumb;

} else {

 // 显示默认图片或者不做任何事情

}?>

</div> 

      <h4><a href="<?php the_permalink() ?>" data-no-turbolink="true" target="_blank" title="<?php the_title(); ?>"><?php the_title(); ?></a></h4>

      <div class="post_meta sep5 muted"><?php the_category(' • ') ?> • <abbr class="timeago" title="<?php the_time('Y-m-d'); ?>"></abbr></div>



        <div class="excerpt">

         <p><?php echo mb_strimwidth(strip_tags($post->post_content),0,193,'…');?></p>

         <div class="post_meta sep-10 muted">

		 <?php

$args = array(

	'post_id' => $id, //文章ID

	'number' => 1, //返回1条

	'status' => 'approve' //返回已经批准的评论

); 

$comments = get_comments($args);

//输出评论

foreach( $comments as $comment) :

$avatar=get_avatar($comment->comment_author_email,25);

	echo($avatar. $comment->comment_author . ' 说:' . $comment->comment_content);

endforeach

?>

          <a class="pull-right sep-5"><a title="点击阅读全文" class="pull-right" href="<?php the_permalink() ?>">评论(<?php $id=$post->ID; echo get_post($id)->comment_count;?>)</a>

        </div>

      </div>

</div>

<?php endwhile; endif; ?>

<div class="row-fluid">

        <div class="span12"><?php pagenavi($query_string);?></div>

</div>

      </div>

<?php get_sidebar(); ?>

    </div>

<?php get_footer(); ?>

<script type="text/javascript">



jQuery.ias({

  container : '.krContent',

  item: '.blogPost',

  pagination: '.pagination',

  next: '.next_page a',

  loader: '正为您载入更多...',

  trigger: '下一页',

  onRenderComplete: function() {

      $("abbr.timeago").timeago();

  },

  onPageChange: function(pageNum, pageUrl, scrollOffset) {

    path = jQuery('<a/>').attr('href',pageUrl)[0].pathname.replace(/^[^\/]/,'/');

    _gaq.push(['_trackPageview', path]);

  }

});



function recordOutboundLink(link, category, action) {

  try {

    var pageTracker=_gat._getTracker("UA-1268479-12");

    pageTracker._trackEvent(category, action);

  } catch(err) {}

}



var _gaq = _gaq || [];

_gaq.push(['_setSiteSpeedSampleRate', 100]);

_gaq.push(['_setAllowLinker', true]);

_gaq.push(['_trackPageview']);

_gaq.push(['_trackTiming', 'Garelic', 'Response (Total)', 70, 'TopicsController#index']);

_gaq.push(['_trackTiming', 'Garelic', 'Response (Views)', 49, 'TopicsController#index']);

_gaq.push(['_trackTiming', 'Garelic', 'Response (ActiveRecord)', 0, 'TopicsController#index']);



jQuery(document).ready(function($) {

  $('a[href^="http"]:not([href*="//' + location.host + '"])').live('click', function(e) {

    _gaq.push(['_trackEvent', 'outbound', 'click', this.href.match(/\/\/([^\/]+)/)[1]]);

  });

});

</script>

</div>

</html>