本文整理汇总了PHP中common_node::getFirstParentPage方法的典型用法代码示例。如果您正苦于以下问题:PHP common_node::getFirstParentPage方法的具体用法?PHP common_node::getFirstParentPage怎么用?PHP common_node::getFirstParentPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common_node
的用法示例。
在下文中一共展示了common_node::getFirstParentPage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processPage
/**
* process page
*/
public function processPage()
{
if (!is_numeric($this->GET['id'])) {
return false;
}
/**
* get node detail
*/
require_once 'models/common/common_node.php';
$Node = new common_node();
$node_data = $Node->nodeDetail($this->GET['id']);
/**
* prepare titles
*/
if (trim($node_data['page_title']) == '') {
$node_data['page_title'] = $node_data['title'];
}
// page title is also used component/page_header, this will be effective only if page_title is directly in page template
if (trim($node_data['browser_title']) == '') {
$node_data['browser_title'] = $node_data['page_title'];
}
/**
* fallback on options to global configuration
*/
if (!isset($node_data['display_title'])) {
$node_data['display_title'] = $GLOBALS['onxshop_conf']['global']['display_title'];
}
if (!isset($node_data['display_secondary_navigation'])) {
$node_data['display_secondary_navigation'] = $GLOBALS['onxshop_conf']['global']['display_secondary_navigation'];
}
/**
* display page header
*/
if ($node_data['display_title']) {
$_Onxshop_Request = new Onxshop_Request("component/page_header~id={$node_data['id']}~");
$this->tpl->assign('PAGE_HEADER', $_Onxshop_Request->getContent());
}
/**
* display secondary navigation
*/
if ($node_data['display_secondary_navigation'] == 1) {
$first_page_id = $Node->getFirstParentPage($_SESSION['active_pages']);
//type=page_and_products
$_Onxshop_Request = new Onxshop_Request("component/menu~level=0:expand_all=0:display_teaser=1:id={$first_page_id}:open={$node_data['id']}~");
$this->tpl->assign('SECONDARY_NAVIGATION', $_Onxshop_Request->getContent());
$this->tpl->parse('content.secondary_navigation');
}
/**
* get related_taxonomy
*/
$related_taxonomy = $this->getNodeRelatedTaxonomy($node_data);
/**
* create taxonomy class
*/
$node_data['taxonomy_class'] = $this->createTaxonomyClass($related_taxonomy);
/**
* create hierarchy CSS class
*/
$node_data['hierarchy_class'] = $this->createHierarchyClass($_SESSION['full_path']);
/**
* save node_controller, page css_class, current node id, breadcrumb and taxonomy_class into registry to be used in sys/(x)html* as body class
*/
$body_css_class = "{$node_data['node_controller']} {$node_data['css_class']} {$node_data['taxonomy_class']} node_id_{$this->GET['id']} {$node_data['hierarchy_class']}";
$this->saveBodyCssClass($body_css_class);
/**
* save node_id to registry
*/
Zend_Registry::set('node_id', $this->GET['id']);
/**
* process open graph tags
*/
$this->processOpenGraph($node_data);
/**
* assign to template
*/
$this->tpl->assign("NODE", $node_data);
return true;
}
示例2: getProductVarietyList
/**
* get product variety list
*
* check requested list
* can be product_id_list or node_id
* if node_id not provided, use first parent page
*/
function getProductVarietyList()
{
$filter = array();
//this filter option will ensure listing only enabled products and varieties
$filter['publish'] = 1;
//image role filter
if (in_array($this->GET['image_role'], array('default', 'teaser', 'feature', 'background', 'RTE'))) {
$filter['image_role'] = $this->GET['image_role'];
} else {
$filter['image_role'] = 'main';
}
$this->tpl->assign('IMAGE_ROLE', $filter['image_role']);
if (is_array($this->GET['product_id_list'])) {
/*
passed from this controllers:
./component/ecommerce/best_buys.php
./component/ecommerce/recently_viewed_products.php
./component/ecommerce/product_related_basket.php
./component/ecommerce/product_related_to_customer.php
./component/ecommerce/product_related.php
*/
$filter['product_id_list'] = $this->GET['product_id_list'];
$product_variety_list = $this->Product->getFilteredProductList($filter, GLOBAL_LOCALE_CURRENCY);
/**
* modify priority according sort of product_id_list
*/
if ($this->GET['product_id_list_force_sorting_as_listed']) {
foreach ($product_variety_list as $key => $item) {
$product_variety_list[$key]['priority'] = 1000 - array_search($item['product_id'], $this->GET['product_id_list']);
}
}
} else {
/**
* initialize node
*/
require_once 'models/common/common_node.php';
$Node = new common_node();
/**
* Find node_id
* 1. can be provided
* 2. detected from place where the component sits
*/
if (is_numeric($this->GET['id'])) {
$node_id = $this->GET['id'];
//TODO find first parent page from given "id"
//$node_id = $Node->getFirstParentPage($_SESSION['active_pages']);
} else {
$node_id = $Node->getFirstParentPage($_SESSION['active_pages']);
//don't continue if node_id is not numeric (i.e. empty SESSION.active_pages)
if (!is_numeric($node_id)) {
return false;
}
}
/**
* filter, find if taxonomy is set for node
*/
if ($this->GET['taxonomy_tree_id']) {
$taxonomy = explode(",", $this->GET['taxonomy_tree_id']);
if (count($taxonomy) > 0 && is_numeric($taxonomy[0])) {
$filter['taxonomy_json'] = json_encode($taxonomy);
}
} else {
if ($taxonomy = $Node->getTaxonomyForNode($node_id)) {
//add extra taxonomy filter
$taxonomy = $this->addTaxonomyFilter($taxonomy);
$filter['taxonomy_json'] = json_encode($taxonomy);
} else {
//add taxonomy filter from session or POST
$taxonomy = $this->addTaxonomyFilter();
if (count($taxonomy) > 0) {
$filter['taxonomy_json'] = json_encode($taxonomy);
}
}
}
/**
* add keyword filter
*/
$filter['keyword'] = $this->addKeywordFilter();
/**
* fallback to listing products which homepage is under the node_id
*/
if (empty($filter['taxonomy_json']) && empty($filter['keyword'])) {
$filter['node_id'] = $node_id;
}
/**
* get product list
*
*/
$product_variety_list = $this->Product->getFilteredProductList($filter, GLOBAL_LOCALE_CURRENCY);
}
//print_r($product_variety_list);
return $product_variety_list;
}