Saturday, April 26, 2014

web site article traffic save using php codeigniter with datatable

//extend table by traffic
        $e_article_key = $this::ARTICLE_EXTEND_SESSION_NAME . $article['id'];
        $article_extend = $this->session->userdata($e_article_key);
        $db_article_extend = $this->article_extend_model->get(array('article_id' => $article['id']));
        if (isset($db_article_extend['hitcount']) &&
                isset($article_extend['hitcount']) &&
                $db_article_extend['hitcount'] != $article_extend['hitcount']) {
            $article_extend = $db_article_extend;
        }
        if (!isset($article_extend['hitcount'])) {

            if (isset($db_article_extend['hitcount'])) {
                $article_extend = $db_article_extend;
            }
            if (empty($article_extend)) {
                $article_extend = array();
                $article_extend['article_id'] = $article['id'];
                $article_extend['hitcount'] = 0;
            }
            $article_extend['hitcount'] = $article_extend['hitcount'] + 1;
          
            $this->article_extend_model->save($article_extend);
            $this->session->set_userdata($e_article_key, $article_extend);
        }
        $data['article_extend'] = $article_extend;

        return $data;

Wednesday, April 2, 2014

bootstrap references html syntax sample

<link href="assets/css/bootstrap.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
     
<link rel="stylesheet" href="assets/css/tg.css" type="text/css"/>
     
<!-- Javascript -->
<script type='text/javascript' src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js"></script>
<script type='text/javascript' src="assets/js/css3-mediaqueries.js"></script>  
 
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
  <script type='text/javascript' src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <script type='text/javascript' src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js"></script>
<![endif]-->