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


PHP Products::getAllHighlighted方法代碼示例

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


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

示例1: indexAction

 /**
  * Create a RSS file with the CMS pages and Products
  */
 public function indexAction()
 {
     $out = "";
     try {
         $ISP = Shineisp_Registry::get('ISP');
         $ns = new Zend_Session_Namespace();
         $localeID = $ns->idlang;
         $locale = $ns->lang;
         $feed = new Zend_Feed_Writer_Feed();
         $feed->setTitle($ISP->company);
         $feed->setLink($ISP->website);
         $feed->setFeedLink('http://' . $_SERVER['HTTP_HOST'] . '/rss', 'atom');
         $feed->addAuthor(array('name' => $ISP->company, 'email' => $ISP->email, 'uri' => $ISP->website));
         $feed->setEncoding('UTF8');
         $feed->setDateModified(time());
         $feed->addHub($ISP->website);
         // Get all the cms pages
         $records = CmsPages::getRssPages($locale);
         foreach ($records as $record) {
             $link = 'http://' . $_SERVER['HTTP_HOST'] . '/cms/' . $record['var'] . '.html';
             self::createEntry($feed, $record['title'], $record['body'], $link);
         }
         // Get all the products
         $records = Products::getAllHighlighted($localeID);
         foreach ($records as $record) {
             $title = $record['ProductsData'][0]['name'];
             $descritption = strip_tags($record['ProductsData'][0]['shortdescription']);
             $inserted_at = !empty($record['inserted_at']) ? strtotime($record['inserted_at']) : null;
             $updated_at = !empty($record['updated_at']) ? strtotime($record['updated_at']) : null;
             $link = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $record['uri'] . '.html';
             self::createEntry($feed, $title, $descritption, $link, $inserted_at, $updated_at);
         }
         /**
          * Render the resulting feed to Atom 1.0 and assign to $out.
          * You can substitute "atom" with "rss" to generate an RSS 2.0 feed.
          */
         $out = $feed->export('atom');
     } catch (Zend_Feed_Exception $e) {
         die($e->getMessage());
     }
     die($out);
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:45,代碼來源:RssController.php

示例2: fill_content

 /**
  * Prepare the newsletter content
  */
 private static function fill_content()
 {
     $ns = new Zend_Session_Namespace();
     $contents = array();
     // Get all the products
     $contents['products'] = "<ul>";
     $records = Products::getAllHighlighted($ns->idlang);
     foreach ($records as $record) {
         $contents['products'] .= "<b><a href='http://" . $_SERVER['HTTP_HOST'] . "/" . $record['uri'] . ".html'>" . $record['ProductsData'][0]['name'] . "</a></b><p>" . $record['ProductsData'][0]['shortdescription'] . "</p>";
     }
     $contents['products'] .= "</ul>";
     // Get all the cms pages
     $contents['pages'] = "";
     $records = CmsPages::getRssPages($ns->lang);
     foreach ($records as $record) {
         $link = 'http://' . $_SERVER['HTTP_HOST'] . '/cms/' . $record['var'] . '.html';
         $contents['pages'] .= "<p><b><a href='" . $link . "'>" . $record['title'] . "</a></b></p>";
         $contents['pages'] .= Shineisp_Commons_Utilities::truncate($record['body'], 200, "...", false, true);
     }
     $contents['pages'] = str_replace("src=\"/", "src=\"http://" . $_SERVER['HTTP_HOST'] . "/", $contents['pages']);
     return $contents;
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:25,代碼來源:Newsletters.php


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