I
I
Ivan2018-08-06 10:09:04
HTML
Ivan, 2018-08-06 10:09:04

How to disable the display of an element on certain pages in Bitrix?

Hello!
There was such a question.
There is a Bitrix template, there is an element (bitrix/templates/.default/components/bitrix/menu/left/template.php)
Now it is displayed on almost all pages, I don’t need it to be licked on the pages: About the company, Vacancies, News, Publications.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kudis, 2018-08-06
@kudis

Wrap the component call in conditions:
for example: if necessary with subsections:
or a more complicated condition:

if (preg_match('/^\/news\/[\d]+\/.*/', $APPLICATION->GetCurDir()) === 1 ) {}

A
Alexander, 2018-08-06
Madzhugin @Suntechnic

Let me try to reformulate your question:
You have a menu and in this menu there is an item that should not be displayed on some pages (or vice versa - should be displayed on some - here I did not really understand).
Generally speaking, this usually means that your menu performs a role that is not characteristic of it. Those. If there is such a need, then most likely something has already gone wrong with you. But of course it happens in different ways... 1 Don't touch the template (file bitrix/templates/ .default
/components/bitrix/menu/left/template.php)
item - https://dev.1c-bitrix.ru/learning/course/index.php...
There is another option - you are not talking about a menu item, but about a component. It's quite simple here - place it only on those pages where it should be displayed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question