本文整理汇总了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);
}
示例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;
}