示例#1
0
 /**
  */
 public function next()
 {
     $type = 'picture';
     $pagination = $this->input->post('page', TRUE);
     $ulclass = $this->input->post('ulclass', TRUE);
     if (isset($ulclass) && $ulclass == 'true') {
         $sponserList = 'style="display:none"';
         $description = 'style="display:block"';
     } else {
         $sponserList = 'style="display:block"';
         $description = 'style="display:none"';
     }
     if (isset($pagination) && $pagination != '') {
         $next_set = $pagination;
     } else {
         $next_set = $this->uri->segment(3) ? $this->uri->segment(3) : 0;
     }
     $count = $this->feedModel->getAllDataCount($type);
     $config = array();
     $config["base_url"] = base_url() . "home/next";
     $config["total_rows"] = $count;
     $config["per_page"] = 22;
     $config['use_page_numbers'] = true;
     $config["uri_segment"] = 3;
     $config['num_links'] = '10';
     $config['last_link'] = '';
     $this->pagination->initialize($config);
     $page = $next_set;
     $limit = $config["per_page"];
     $offset = $limit * ($page - 1);
     $feeds_list = $this->getAllData($limit, $offset, $type);
     $pagination_links = $this->pagination->create_links();
     $postsdata = '';
     $countForAd = 1;
     if (!empty($feeds_list)) {
         $default_image = getDefaultImage();
         $default_url = 'javascript:void(0)';
         foreach ($feeds_list as $feed) {
             $feed_url = isset($feed->feed_url) ? $feed->feed_url : $default_url;
             $feed_title = isset($feed->feed_title) ? $feed->feed_title : 'title';
             //                Get the title
             $feed_image_title = isset($feed->feed_user_title) ? $feed->feed_user_title : 'Admin';
             $feed_title_truncated = substr($feed_image_title, 0, 40);
             $alt_image = isset($feed->feed_image_title) ? $feed->feed_image_title : '';
             // Feed content to remove the html tags and get the first image
             $html = $feed->feed_content;
             preg_match_all('/<img[^>]+>/i', $html, $result);
             $feed_image = $result;
             $date = isset($feed->feed_date) ? $feed->feed_date : date('Y-m-d');
             $feed_image = isset($feed_image[0][0]) ? $feed_image[0][0] : $default_image;
             //                $avater = isset($feed->feed_image_urls) ? $feed->feed_image_urls : site_url('assets/img/avatar.jpg');
             $avatar = feedIconByUrl($feed->feed_admin_url);
             if (!empty($avatar)) {
                 $favicon = site_url() . 'uploads/feed/' . $avatar;
             } else {
                 $favicon = site_url('assets/img/avatar.jpg');
             }
             if ($countForAd == 4) {
                 $postsdata .= '<li class="sponserList"' . $sponserList . '>';
                 $postsdata .= '<div class="item sponsor">';
                 $postsdata .= '<div class="img">';
                 $postsdata .= '<a href="javascript:void(0)">' . sidebarAd() . '</a>';
                 $postsdata .= '</div>';
                 $postsdata .= '<div class="ads text_center">';
                 $postsdata .= '<a href="javascript:void(0)">SPONSOR ADS</a>';
                 $postsdata .= '</div>';
                 $postsdata .= '</div>';
                 $postsdata .= '</li>';
             }
             if ($countForAd == 13) {
                 $postsdata .= '<li class="sponserList"' . $sponserList . '>';
                 $postsdata .= '<div class="small_height">';
                 $postsdata .= '<div class="item">';
                 $postsdata .= '<div class="img_class">';
                 $postsdata .= '<a href="javascript:void(0)">' . pageinsideAd() . '</a>';
                 $postsdata .= '</div>';
                 $postsdata .= '</div>';
                 $postsdata .= '</div>';
                 $postsdata .= '<div class="small_height">';
                 $postsdata .= '<div class="item">';
                 $postsdata .= '<div class="img_class">';
                 $postsdata .= '<a href="javascript:void(0)">' . pageinsideTwo() . '</a>';
                 $postsdata .= '</div>';
                 $postsdata .= '</div>';
                 $postsdata .= '</div>';
                 $postsdata .= '</li>';
             }
             $postsdata .= '<li>';
             $postsdata .= '<div class="item">';
             $postsdata .= '<div class="img getImage">';
             $postsdata .= '<a href ="' . $feed_url . '">' . $feed_image . '</a>';
             $postsdata .= ' </div>';
             $postsdata .= '<div class="rightSide">';
             $postsdata .= '<div class="name">';
             $postsdata .= '<a href="' . $feed_url . '">' . $feed_title . '</a>';
             $postsdata .= '</div>';
             $postsdata .= '<div class="description textStyle" ' . $description . '>' . strip_tags(substr($html, 0, 800)) . '</div>';
             $postsdata .= '</div>';
             $postsdata .= '<div class="bottom table wd100_wd clear_fix">';
             $postsdata .= '<div class="author wd80_wd clear_fix">';
             $postsdata .= '<div class="author_img fl_left">';
             $postsdata .= '<a href="' . $feed_url . '">';
             $postsdata .= '<img class="avatar_class" src = "' . $favicon . '" alt = "' . $alt_image . '">';
             $postsdata .= '</a>';
             $postsdata .= '</div>';
             $postsdata .= '<div>';
             $postsdata .= '<div class="author_name">';
             $postsdata .= '<a href="' . $default_url . '">' . $feed_title_truncated . '</a>';
             $postsdata .= '</div>';
             $postsdata .= '<div class="date">' . date("d-M-y", strtotime($date)) . '</div>';
             $postsdata .= '</div>';
             $postsdata .= ' </div>';
             $postsdata .= '<div class="main_content_share_button wd20_wd" style="">
                             <script type="text/javascript">var switchTo5x = true;</script>
                             <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
                             <script type="text/javascript">stLight.options({publisher: "d661bce1-3df6-41f2-a167-27cb74203fc1", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>
                             <div id="slideToggleParent_' . $feed->id . '" class="main_content_share" style="display: none">
                                 <span class="st_facebook_large" displayText="Facebook"></span>
                                 <span class="st_twitter_large" displayText="Tweet"></span>
                                 <span class="st_email_large" displayText="Email"></span>
                                 <span class="st_plusone_large" displayText="Google +1"></span>
                             </div>
                             <div id="slideToggle_' . $feed->id . '" onclick="javascript:getShareDiv(' . $feed->id . ')" class="icon slideToggle">
                                 <a href="javascript:void(0)"></a>
                             </div>
                         </div>';
             $postsdata .= '</div>';
             $postsdata .= '</li>';
             $countForAd++;
         }
         echo $postsdata;
         return;
     } else {
         return;
     }
 }
示例#2
0
        $feed_title_title = isset($feed->feed_user_title) ? $feed->feed_user_title : '';
        $feed_title = substr($feed_title_title, 0, 40);
        $avatar = feedIconByUrl($feed->feed_admin_url);
        if (!empty($avatar)) {
            $favicon = site_url() . 'uploads/feed/' . $avatar;
        } else {
            $favicon = site_url('assets/img/avatar.jpg');
        }
        if ($count == 4) {
            ?>
                    <li class="sponserList">
                        <div class="item sponsor">
                            <div class="img">
                                <a href="javascript:void(0)">
                                    <?php 
            echo sidebarAd();
            ?>
                                </a>
                            </div>
                            <div class="ads text_center">
                                <a href="#">SPONSOR ADS</a>
                            </div>
                        </div>
                    </li>
                    <?php 
        }
        ?>
 
                <?php 
        if ($count == 13) {
            ?>