Documentation

GetPageNavStringEx

CMain::GetPageNavStringEx(
 navComponentObject,
 navigationTitle, 
 templateName = "",
 showAlways=false,
 parentComponent=nul
componentParams
 )

Returns pagewise navigation panel in the HTML format. Generates its using specified parameters. Non-static method.

Parameters

Parameter Description Available from version
navComponentObjectEnable reverse navigation
navigationTitle Category name
templateNameTemplate name
showAlways To always show
parentComponentPage caching time for reverse navigation
componentParamsUsed to substitute $arParams array for the system.pagenavigation component, based on which the method operates. For example, the result selection is retrieved via ajax with resulting pagination for the page from which a $_POST was passed:
$res = CIBlockElement::GetList(Array("SORT"=>"ASC", "ID"=>"ASC"), $_POST["myFilter"], false, $arNavStartParams, $arSelect);
$res->NAV_STRING = $res->GetPageNavStringEx($navComponentObject, "", "qp_korm", true, null, array("BASE_LINK"=>$_SERVER["HTTP_REFERER"]);

Examples of use

CModule::IncludeModule('iblock');
$arSort = array();
$arFilter = array('IBLOCK_ID'=> '1');
$arNavParams = array(
        "nPageSize" => '2',
        "bDescPageNumbering" => 'Description',
        "bShowAll" => 'Y',
    );  

$arSelect = array("ID", "NAME");
$rsElement = CIBlockElement::GetList($arSort, $arFilter, false, $arNavParams, $arSelect);
$NAV_STRING = $rsElement->GetPageNavStringEx($navComponentObject, 'Title', '', 'Y');
echo $NAV_STRING."
"; while($arElem = $rsElement->Fetch()) { echo $arElem['ID']."__".$arElem["NAME"]."
"; } echo $NAV_STRING;

Example of use in components 2.0

$rsElements = CIBlockElement::GetList($arSort, $arFilter, false, array("nPageSize" => $arParams["PAGE_COUNT"], "bShowAll" => false), $arSelect);
....
$arResult["NAV_STRING"] = $rsElements->GetPageNavStringEx($navComponentObject, "", $arParams["PAGER_TEMPLATE"]);

Now, in $arResult["NAV_STRING"] we are getting full pagewise navigation, wrapped into the $arParams["PAGER_TEMPLATE"] template. If $arParams["PAGER_TEMPLATE"] is empty, then the .default is taken.

Sometimes, to avoid displaying too much pages (1....11, 12, 13, 14, 15, 16, 17...100) but, for example, 3 (1....14, 15, 16...100) pages.

In the example above, prior calling GetPageNavStringEx the following must be specified:

$rsElements->nPageWindow = 3;


© «Bitrix24», 2001-2024
Up