Skip to content

Instantly share code, notes, and snippets.

@geff21st
Created December 27, 2016 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geff21st/efd576222b2ffd7ab07dfed9e1353307 to your computer and use it in GitHub Desktop.
Save geff21st/efd576222b2ffd7ab07dfed9e1353307 to your computer and use it in GitHub Desktop.
<snippet>
<content><![CDATA[
if(!Bitrix\Main\Loader::includeModule("iblock"))return;
\$arItems = array();
\$arOrder = array(${1:"sort" => "asc"${2:, "date_active_from" => "desc"}});
\$arFilter = array(
${4:"ACTIVE" => "Y", "ACTIVE_DATE" => "Y",
"IBLOCK_ID" => ${3:SOME}_IBLOCK,}${5}
);
\$arSelect = array("ID", "IBLOCK_ID", "NAME"${6});
\$res = CIblockElement::GetList(\$arOrder, \$arFilter, false, ${8:array("nTopCount"=>${7:20})}, \$arSelect);
while (\$item = \$res->GetNext()) {
\$arItems[] = \$item;${0}
}
//d(\$arItems);
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>getlist</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment