P
P
Pavel Khorikov2015-06-01 14:40:56
Yii
Pavel Khorikov, 2015-06-01 14:40:56

How to make a form like this using yii\helpers\Html?

There is a search form of the following type.
1dba9a491c744beebfc7535496d7a821.png
I want to pass to the controller in the actionSearch() method everything that the user submits.
How to turn this HTML:

<ul id="searchParams" class="dropdown-menu" role="menu">
     <li value="1"><a href="" title="Например, someauthor">Поиск автора </a></li>
     <li value="2"><a href="" title="Например, some word">Поиск публикации </a></li>
</ul>

into a similar php code:
<?php echo Html::ul($items = ['Поиск автора', 'Поиск публикации'], [
                    'class' => 'dropdown-menu',
                    'id' => 'searchParams',
                    'role' => 'menu',
                ]);
                ?>

Please tell me how:
1. Wrap $items for the list in Html::a() tag; ?
2. Set list items ($items)
Html::ul($items = ['Поиск автора', 'Поиск публикации'])

value attribute, for example?
3. Set Html::a() elements attributes and assign some values ​​to the attributes?
Thanks in advance for good advice. I want to do feng shui).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Grechushnikov, 2015-06-01
@maxyc_webber

what is the problem with inserting html tags by hand? no one obliges you to write pure php code. and yes it will be right

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question