當前位置: 首頁>>代碼示例>>PHP>>正文


PHP RevSlide::initByPostData方法代碼示例

本文整理匯總了PHP中RevSlide::initByPostData方法的典型用法代碼示例。如果您正苦於以下問題:PHP RevSlide::initByPostData方法的具體用法?PHP RevSlide::initByPostData怎麽用?PHP RevSlide::initByPostData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在RevSlide的用法示例。


在下文中一共展示了RevSlide::initByPostData方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getSlidesFromPosts

 /**
  * get slides from posts
  */
 public function getSlidesFromPosts($publishedOnly = false, $gal_ids = array())
 {
     $slideTemplates = $this->getSlidesFromGallery($publishedOnly);
     $slideTemplates = RevSliderFunctions::assocToArray($slideTemplates);
     if (count($slideTemplates) == 0) {
         return array();
     }
     $sourceType = $this->getParam("source_type", "gallery");
     if (!empty($gal_ids)) {
         $sourceType = 'specific_posts';
     }
     //change to specific posts, give the gal_ids to the list
     switch ($sourceType) {
         case "posts":
             //check where to get posts from
             $sourceType = $this->getParam("fetch_type", "cat_tag");
             switch ($sourceType) {
                 case 'cat_tag':
                 default:
                     $arrPosts = $this->getPostsFromCategories($publishedOnly);
                     break;
                 case 'related':
                     $arrPosts = $this->getPostsFromRelated();
                     break;
                 case 'popular':
                     $arrPosts = $this->getPostsFromPopular();
                     break;
                 case 'recent':
                     $arrPosts = $this->getPostsFromRecent();
                     break;
                 case 'next_prev':
                     $arrPosts = $this->getPostsNextPrevious();
                     break;
             }
             break;
         case "specific_posts":
             $arrPosts = $this->getPostsFromSpecificList($gal_ids);
             break;
         case 'woocommerce':
             $arrPosts = $this->getProductsFromCategories($publishedOnly);
             break;
         default:
             RevSliderFunctions::throwError("getSlidesFromPosts error: This source type must be from posts.");
             break;
     }
     $arrSlides = array();
     $templateKey = 0;
     $numTemplates = count($slideTemplates);
     foreach ($arrPosts as $postData) {
         $slideTemplate = clone $slideTemplates[$templateKey];
         //advance the templates
         $templateKey++;
         if ($templateKey == $numTemplates) {
             $templateKey = 0;
             $slideTemplates = $this->getSlidesFromGallery($publishedOnly);
             //reset as clone did not work properly
             $slideTemplates = RevSliderFunctions::assocToArray($slideTemplates);
         }
         $slide = new RevSlide();
         $slide->initByPostData($postData, $slideTemplate, $this->id);
         $arrSlides[] = $slide;
     }
     $this->arrSlides = $arrSlides;
     return $arrSlides;
 }
開發者ID:ksan5835,項目名稱:maadithottam,代碼行數:68,代碼來源:slider.class.php

示例2: getSlidesFromPosts

 /**
  * 
  * get slides from posts
  */
 private function getSlidesFromPosts($publishedOnly = false)
 {
     $slideTemplates = $this->getSlideTemplates();
     $slideTemplates = UniteFunctionsRev::assocToArray($slideTemplates);
     if (count($slideTemplates) == 0) {
         return array();
     }
     $sourceType = $this->getParam("source_type", "gallery");
     switch ($sourceType) {
         case "posts":
             $arrPosts = $this->getPostsFromCategoies($publishedOnly);
             break;
         case "specific_posts":
             $arrPosts = $this->getPostsFromSpecificList();
             break;
         default:
             UniteFunctionsRev::throwError("getSlidesFromPosts error: This source type must be from posts.");
             break;
     }
     $arrSlides = array();
     $templateKey = 0;
     $numTemplates = count($slideTemplates);
     $slideTemplate = $slideTemplates[$templateKey];
     foreach ($arrPosts as $postData) {
         //advance the templates
         $templateKey++;
         if ($templateKey == $numTemplates) {
             $templateKey = 0;
         }
         $slide = new RevSlide();
         $slide->initByPostData($postData, $slideTemplate, $this->id);
         $arrSlides[] = $slide;
     }
     $this->arrSlides = $arrSlides;
     return $arrSlides;
 }
開發者ID:ConceptHaus,項目名稱:huasca,代碼行數:40,代碼來源:revslider_slider.class.php

示例3: getSlidesFromPosts

 /**
  * get slides from posts
  */
 public function getSlidesFromPosts($publishedOnly = false)
 {
     $slideTemplates = $this->getSlidesFromGallery($publishedOnly);
     $slideTemplates = RevSliderFunctions::assocToArray($slideTemplates);
     if (count($slideTemplates) == 0) {
         return array();
     }
     $sourceType = $this->getParam("source_type", "gallery");
     switch ($sourceType) {
         case "posts":
             $arrPosts = $this->getPostsFromCategories($publishedOnly);
             break;
         case "specific_posts":
             $arrPosts = $this->getPostsFromSpecificList();
             break;
         case 'woocommerce':
             $arrPosts = $this->getProductsFromCategories($publishedOnly);
             break;
         default:
             RevSliderFunctions::throwError("getSlidesFromPosts error: This source type must be from posts.");
             break;
     }
     $arrSlides = array();
     $templateKey = 0;
     $numTemplates = count($slideTemplates);
     foreach ($arrPosts as $postData) {
         $slideTemplate = clone $slideTemplates[$templateKey];
         //advance the templates
         $templateKey++;
         if ($templateKey == $numTemplates) {
             $templateKey = 0;
             $slideTemplates = $this->getSlidesFromGallery($publishedOnly);
             //reset as clone did not work properly
             $slideTemplates = RevSliderFunctions::assocToArray($slideTemplates);
         }
         $slide = new RevSlide();
         $slide->initByPostData($postData, $slideTemplate, $this->id);
         $arrSlides[] = $slide;
     }
     $this->arrSlides = $arrSlides;
     return $arrSlides;
 }
開發者ID:jfbelisle,項目名稱:magexpress,代碼行數:45,代碼來源:slider.class.php


注:本文中的RevSlide::initByPostData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。