PHP code example of izica / iblock-query
1. Go to this page and download the library: Download izica/iblock-query library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
izica / iblock-query example snippets
$arBadgesItems = IblockQuery::items()
->filter($arFilter)
->select($arSelect)
->sort($arSort)
->nav($arNav)
->properties(false) // выключает запрос на доп. свойства
->cache()
->map(function($arItem){
$arItem['PREVIEW_PICTURE'] = CFile::GetPath($arItem['PREVIEW_PICTURE']);
return $arItem;
})
->execute(); // возвращает экземляр класса IblockQueryResult
$arBadgesSections = IblockQuery::sections()
->filter($arFilter)
->select($arSelect)
->sort($arSort)
->nav($arNav)
->cache()
->execute()
->all();
$arBadgesSections = IblockQuery::items()
->filter($arFilter)
->select($arSelect)
->sort($arSort)
->nav($arNav)
->properties(false)
->cache()
->map(function($arItem){
$arItem['PREVIEW_PICTURE'] = CFile::GetPath($arItem['PREVIEW_PICTURE']);
return $arItem;
})
->execute();
$arBadgesItems = IblockQuery::items()
->filter(['IBLOCK_ID' => $nBadgesIblockId])
->select(['ID', 'NAME', 'PROPERTY_COLOR'])
->execute();
$arBadgesSections = IblockQuery::sections()
->filter(['IBLOCK_ID' => $nBadgesIblockId])
->select(['ID', 'NAME', 'PROPERTY_COLOR'])
->execute();
$arBadgesItems = IblockQuery::items()
->filter($arFilter)
->select($arSelect)
->sort($arSort)
->nav($arNav)
->properties(false)
->cache()
->execute();