P
P
Pavel Khorikov2015-07-03 13:35:07
Yii
Pavel Khorikov, 2015-07-03 13:35:07

How to organize work with search results (Yii2)?

In general, there is a search form by authors.
00caaaf52fa04bbfa04fef79696f1929.png
Works correctly, even looking for something, for example. here:
32ef132c1e884912ac4ce39e3562906f.png
The question is how to work with search results in Yii (Url::to(), Url::toRoute(), etc..)
As you can see from the screenshot, in the drop-down menu of the option there is an information item that leads to the full profile of the author and renders the corresponding view.
How to redirect via actionView() to the desired author profile?
Tried to write like this

<li><a href="<?php echo Url::to(['default/view', 'id'=>$authors['id']]); ?>">Информация</a></li>

And in
public function actionView()
{
  return $this->render('__authorsFullProfile');
}

The view renders, it seems to generate a valid url (index/view?id=20) but the data does not reach.
5698438d60e1442796cce5061e353ccf.png
Where did you go wrong, guys? Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rikcon, 2015-07-03
@Horik_off

Do you see GET['id'] in the controller?
var_dump( Yii::$app->request->get('id'));
Throw it in the controller and see if it sees the variable at all /
And + I don’t see in your actionView that you would get the profile from the database and pass it to the view.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question