A
A
Askfortrue2019-04-03 17:19:14
1C-Bitrix
Askfortrue, 2019-04-03 17:19:14

How to make Selecting a physical section using select with displaying the selected section, if the component is in the page template, like a standard menu?

Hello!
Tell me if there is such an opportunity to organize a menu, that is, navigation through physical partitions using select, with the condition that the selected partition is remembered after a reboot.
I did this from the menu, it works, but does not remember, I tried to play with SELECTED on the example of vertical multilevel, but nothing comes out due to the lack of such knowledge and practice. There, as far as I understand, SELECTED is assigned a css style, it stands out, but I didn’t think of it to be saved in the select, but this is most likely in the wrong direction.
I can’t make a cycle, albeit using examples, but I don’t understand something yet.
Why I chose the Menu for this - because you can organize different menus, and you get convenient navigation and it seems that the standard component has not suffered much. Here's how to remember the selected position, I can not understand, help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill Proger, 2019-04-03
@Askfortrue

to start, let's make an html example that will be in the menu template

<select id="cd-dropdown" class="cd-select" onchange="top.location=this.value">
        <option value="http://site.ru/papka/silka.html">Выбери меня</option>
        <option value="http://site.ru/papka/silka1.html">Выбери меня 1</option>
        <option value="http://site.ru/papka/silka2.html">Выбери меня 2</option>
      </select>

Here we organize the transition through the pages.
Next, we take the Bitrix API
, which will allow us to get the page on which we are, after that we check in the template
If $silka == "links from the menu (variable)" then insert the selected value into the option tag,
which will give us the selected element
logic, I painted everything for you, it remains only to assemble the menu component template

A
Artyom Luchnikov, 2019-04-03
@lu4nik

Here the usual menu component will do. You just need to copy the template into your namespace and replace the list with select there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question