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;

1 comment:

mens ed pills said...

A fascinating discussion is worth comment. I believe that you ought to write more on this issue, it might not be a taboo matter but typically folks don't speak about such issues. To the next! Many thanks!!