Answer the question
In order to leave comments, you need to log in
Competently write the conditions for the section?
Good time,
I collect a non-standard template.
I created a section, let's say News, put the complex news component there.
The question is that in the section itself I have one layout for crumbs, headlines, news.list. Everything in detail.
It turns out that I need to set a condition specifically for news and for detailed ones.
I tried options like
There is something like this:
<?// Это нужно включить ТОЛЬКО для индексной страницы news ?>
<?if (($APPLICATION->GetCurDir()=='/news/')):?>
<div class="container">
<div class="title-container">
<div class="title-container__text">
<h1 class="title"><?$APPLICATION->ShowTitle(false);?></h1>
</div>
<div class="title-container__link">
<a href="#">Предложить свою новость</a>
</div>
</div>
<?$APPLICATION->IncludeComponent(
"bitrix:breadcrumb",
"breadcrumbs",
array(
"COMPONENT_TEMPLATE" => "breadcrumbs",
"START_FROM" => "0",
"PATH" => "",
"SITE_ID" => "s1"
),
false
);?>
</div>
<div class="container">
<section class="news">
<div class="news__panel">
<div class="form">
<form>
<input type="search" placeholder="Поиск по сайту...">
</form>
</div>
</div>
<?else:?>
<?// Это подключается ТОЛЬКО для элементов?>
<div class="title-container-bg" style="background-image: url('/local/templates/default_kvz/img/content/comments-bg.jpg')">
<div class="container">
<h1><?$APPLICATION->ShowTitle(false);?></h1>
</div>
</div>
<div class="container pt-2">
<?$APPLICATION->IncludeComponent(
"bitrix:breadcrumb",
"breadcrumbs",
array(
"COMPONENT_TEMPLATE" => "breadcrumbs",
"START_FROM" => "0",
"PATH" => "",
"SITE_ID" => "s1"
),
false
);?>
</div>
<?endif;?>
Answer the question
In order to leave comments, you need to log in
Place the block that is needed only on the element list pages in the section.php file of the complex component template, and the block that is needed on the detail page in the element.php file of this template.
Hardcore paths in the code is not worth it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question