string CDBResult::NavStringForCache( int page_size=10, bool show_all=true, int page_number=false )
The method NavStringForCache returns the string which uniquely identify the current state of pagewise navigation (number of the current page; display all records or not). The result returned is generally used for building the cache identifier which is used with classes CPageCache and CPHPCache.
Parameter | Description |
---|---|
page_size | Page size (1 or more). Optional; 10 by default. |
show_all | Specifies to display all records (display the link All in the navigation bar). Optional; true by default. |
page_number | Forces the display of the page with the specified number (disregarding the parameters passed on the URL). Optional; false by default (display as is). |
State identifier.
<? // create an instance $obCache = new CPageCache; // caching period of 30 minutes $life_time = 30*60; // create the ID string describing the current state $nav = CDBResult::NavStringForCache($PAGE_ELEMENT_COUNT); // create the cache ID depending on the parameters // that may affect the resulting HTML $cache_id = $nav.$ELEMENT_ID.$IBLOCK_TYPE.$USER->GetUserGroupString(); // initialise the buffered output if($obCache->StartDataCache($life_time, $cache_id, "/")): // get a list of element if ($rsElements = GetIBlockElementList($IBLOCK_ID, $SECTION_ID)): // initialise the pagewise navigation $rsElements->NavStart($PAGE_ELEMENT_COUNT); // display the pagewise navigation echo $rsElements->NavPrint($ELEMENT_NAME); // iterate on elements 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 out the buffered result to the cache file $obCache->EndDataCache(); endif; ?>
© 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |