W
W
wagwandude2016-06-12 10:52:29
PHP
wagwandude, 2016-06-12 10:52:29

CSite::InDir for section subsections?

Good afternoon.

I want to display certain information in header.php for a category and all its attachments (subcategories, subsubcategories).
I did it via CSite::InDir:

if(CSite::InDir('/catalog/odejda/')) {
  echo "Lorem Ipsum";
} else {
  echo "Muspi Merol"
}

However, the URL of subcategories is built in exactly the same way as the category itself - /catalog/kofti/, despite the fact that /kofti/ are located in /odejda/
In the settings of the "Catalogue" component, I changed the construction of the address of the section pages from #SECTION_CODE# to #SECTION_CODE_PATH # and got a link like: /catalog/odejda/kofti/
In this scenario, InDir fits perfectly here, but, unfortunately, I need to leave the standard version of constructing the page address and find another way to write a condition to display the necessary information in the section and its subsections.

This is extremely important to solve, because for the third day I have been tormented by this issue.
Help deal with this!
Thank you very much in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Zakharov, 2016-06-15
@wagwandude

add properties for the section, in which to push the necessary info/image, in the component via result_modifier.php get this data via CIBlockSection::GetList, buffer, output via deferred functions in the header
for subsections, the parent can be obtained via = CIBlockSection::GetNavChain
then like this select properties from the parent and as described above

N
no_one_safe, 2016-06-12
@no_one_safe

Лучше использовать Отложенные функции
В component_epilog.php определяешь как и что выводить. Определяешь свойство страницы через SetPageProperty и через
Выводишь то что нужно.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question