NavStringForCache
string CDBResult::NavStringForCache( int page_size=10, bool show_all=true, int NumPage=false )
Returns unique string that identifies current state of pagewise navigation (number of current page, display "All" records or not). The result of this method is generally used for building the cache identifier which is in turn used in CPageCache and CPHPCache methods. Non-static methods.
Parameters
Parameter | Description |
---|---|
page_size | Page size (from 1 and more). Optional. By default 10. |
show_all | Defines whether to show all records (and the "All" link in the navigation bar). Optional. By default - "true". |
NumPage | Forces the display of the page with the specified number (disregarding the parameters passed to the URL). Optional; false by default (open page depending on parameters in URL). |
See Also
Examples of use
<? // create object $obCache = new CPageCache; // caching time - 30 minutes $life_time = 30*60; // get string that identifies the state of pagewise navigation $nav = CDBResult::NavStringForCache($PAGE_ELEMENT_COUNT); // generate cache identifier, based on all parameters // that can affect the resulting HTML $cache_id = $nav.$ELEMENT_ID.$IBLOCK_TYPE.$USER->GetUserGroupString(); // initialize the output buffering if($obCache->StartDataCache($life_time, $cache_id, "/")): // get list of elements if ($rsElements = GetIBlockElementList($IBLOCK_ID, $SECTION_ID)): // initialize pagewise navigation $rsElements->NavStart($PAGE_ELEMENT_COUNT); // get pagewise navigation echo $rsElements->NavPrint($ELEMENT_NAME); // get the element sequence while ($obElement = $rsElements->GetNextElement()): $arElement = $obElement->GetFields(); $arProperty = $obElement->GetProperties(); echo "<pre>"; print_r($arElement); echo "</pre>"; echo "<pre>"; print_r($arProperty); echo "</pre>"; endwhile; endif; // write the buffered result onto drive in cache file $obCache->EndDataCache(); endif; ?>
© «Bitrix24», 2001-2024