R
R
RudFox2021-02-14 10:57:42
1C-Bitrix
RudFox, 2021-02-14 10:57:42

How to output directory partitions to any desired location?

For example, in Aspro Maximum, a block with catalog sections is displayed on the main page, but it cannot be moved above the main banner on the main page. And I want to move it to the site header under the menu so that this block is shown on all pages.
If you directly insert the code of this block into the header template:

<? $this->setFrameMode( true );?>
<?if($arResult['SECTIONS']):?>
  <?$bIcons = ($arParams['SHOW_ICONS'] == 'Y');?>
  <div class="content_wrapper_block <?=$templateName;?>">
    <div class="maxwidth-theme">
      <div class="sections_wrapper smalls<?=($bIcons ? ' icons' : '');?>">
        <?if($arParams["TITLE_BLOCK"] || $arParams["TITLE_BLOCK_ALL"]):?>
          <div class="top_block">
            <h3><?=$arParams["TITLE_BLOCK"];?></h3>
            <a href="<?=SITE_DIR.$arParams["ALL_URL"];?>" class="pull-right font_upper muted"><?=$arParams["TITLE_BLOCK_ALL"] ;?></a>
          </div>
        <?endif;?>
        <div class="list items">
          <div class="owl-carousel owl-theme owl-bg-nav short-nav hidden-dots visible-nav loading_state cat_sections items slides swipeignore" data-plugin-options='{"animation": "slide", "useCSS": true, "nav": true, "margin":<?=($bIcons ? ' 30' : '50');?>, "dots": false, "loop": false, "rewind": true, "autoplay": false, "responsive": {"0":{"items": 1, "autoWidth": true, "lightDrag": true},"601":{"items": 3, "autoWidth": false, "lightDrag": false},"768":{"items": 4},"992":{"items": 5}, "1200":{"items": 12}}}'>
            <?foreach($arResult['SECTIONS'] as $arSection):
              $this->AddEditAction($arSection['ID'], $arSection['EDIT_LINK'], CIBlock::GetArrayByID($arSection["IBLOCK_ID"], "ELEMENT_EDIT"));
              $this->AddDeleteAction($arSection['ID'], $arSection['DELETE_LINK'], CIBlock::GetArrayByID($arSection["IBLOCK_ID"], "ELEMENT_DELETE"), array("CONFIRM" => GetMessage('CT_BNL_ELEMENT_DELETE_CONFIRM')));?>
              <?if($arParams['USE_FILTER_SECTION'] == 'Y' && $arParams['BRAND_NAME'])
              {
                $arSection["SECTION_PAGE_URL"] .= "filter/brand-is-".$arParams['BRAND_CODE']."/apply/";
              }?>
              <li class="item_block visible height0">
                <div class="item compact" id="<?=$this->GetEditAreaId($arSection['ID']);?>">
                  <div class="img shine">
                    <?if($bIcons && $arSection["UF_CATALOG_ICON"]):?>
                      <?$img = CFile::ResizeImageGet($arSection["UF_CATALOG_ICON"], array( "width" => 40, "height" => 40 ), BX_RESIZE_IMAGE_EXACT, true );?>
                      <a href="<?=$arSection["SECTION_PAGE_URL"]?>" class="thumb">
                        <?if(strpos($img["src"], ".svg") !== false):?>
                          <?=file_get_contents($_SERVER["DOCUMENT_ROOT"].$img["src"]);?>
                        <?else:?>
                          <img class="lazy" data-src="<?=$img["src"]?>" src="<?=\Aspro\Functions\CAsproMax::showBlankImg($img["src"]);?>" alt="<?=($arSection["PICTURE"]["ALT"] ? $arSection["PICTURE"]["ALT"] : $arSection["NAME"])?>" title="<?=($arSection["PICTURE"]["TITLE"] ? $arSection["PICTURE"]["TITLE"] : $arSection["NAME"])?>" />
                        <?endif;?>
                      </a>
                    <?else:?>
                      <?if($arSection["PICTURE"]["SRC"]):?>
                        <?$img = CFile::ResizeImageGet($arSection["PICTURE"]["ID"], array( "width" => 100, "height" => 100 ), BX_RESIZE_IMAGE_EXACT, true );?>
                        <a href="<?=$arSection["SECTION_PAGE_URL"]?>" class="thumb"><img  class="lazy" data-src="<?=$img["src"]?>" src="<?=\Aspro\Functions\CAsproMax::showBlankImg($img["src"]);?>" alt="<?=($arSection["PICTURE"]["ALT"] ? $arSection["PICTURE"]["ALT"] : $arSection["NAME"])?>" title="<?=($arSection["PICTURE"]["TITLE"] ? $arSection["PICTURE"]["TITLE"] : $arSection["NAME"])?>" /></a>
                      <?elseif($arSection["~PICTURE"]):?>
                        <?$img = CFile::ResizeImageGet($arSection["~PICTURE"], array( "width" => 90, "height" => 90 ), BX_RESIZE_IMAGE_EXACT, true );?>
                        <a href="<?=$arSection["SECTION_PAGE_URL"]?>" class="thumb"><img  class="lazy" data-src="<?=$img["src"]?>" src="<?=\Aspro\Functions\CAsproMax::showBlankImg($img["src"]);?>" alt="<?=($arSection["PICTURE"]["ALT"] ? $arSection["PICTURE"]["ALT"] : $arSection["NAME"])?>" title="<?=($arSection["PICTURE"]["TITLE"] ? $arSection["PICTURE"]["TITLE"] : $arSection["NAME"])?>" /></a>
                      <?else:?>
                        <a href="<?=$arSection["SECTION_PAGE_URL"]?>" class="thumb"><img class="lazy" data-src="<?=SITE_TEMPLATE_PATH?>/images/svg/noimage_product.svg" src="<?=\Aspro\Functions\CAsproMax::showBlankImg(SITE_TEMPLATE_PATH.'/images/svg/noimage_product.svg');?>" alt="<?=$arSection["NAME"]?>" title="<?=$arSection["NAME"]?>" height="90" /></a>
                      <?endif;?>
                    <?endif;?>
                  </div>
                  <div class="name font_sm">
                    <a href="<?=$arSection['SECTION_PAGE_URL'];?>" class="dark_link"><?=$arSection['NAME'];?></a>
                  </div>
                </div>
              </li>
            <?endforeach;?>
          </div>
        </div>
      </div>
    </div>
  </div>
<?endif;?>

then it will give this kind of message "Using $this when not in object context". Those. it cannot display the list of categories in the header, because the categories are displayed only in the content part.
I don't understand how to get them out. Tell me please.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
no_one_safe, 2021-02-14
@no_one_safe

What you need to mix is ​​not the component template code, but the call to the component itself.
$APPLICATION->IncludeComponent(.....)

D
Dimonchik, 2017-09-23
@dimonchik2013

you start - and quickly realize
, for example, that each successful response through a public proxy is a probabilistic value
from here - proxy pool and throwing out after N attempts (and adding after N hours), etc. etc.
cheap VPS is better if you are not afraid of banning his IP on the target

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question