Answer the question
In order to leave comments, you need to log in
How to generate page transition links on request?
I decided to make a course on yii2. look into it at the same time. library site type
There is a piece of code in the widget view that creates a list of links in alphabetical order...
echo 'По авторам: ';
$abc = array();
$j=0;
foreach (range(chr(0xC0), chr(0xDF)) as $b){
$abc[] = iconv('CP1251', 'UTF-8', $b);
echo(' '.'<a href="#">'.$abc[$j].' '.'</a>'); $j++;}
echo '<a href="#">'.' '.'[A-Z]'.'</a>';
echo '<br>';
Answer the question
In order to leave comments, you need to log in
Yes, your reasoning is basically correct.
You must create a controller action to select authors by letter and in the link form the URL to this action with the GET parameter - the selected letter.
and controller
public actionAuthors($char = null)
{
$model = Authors::find();
if($char) {
$model->where(['like', 'name', '%'.$char, false])
}
return $this->render('view', ['model' => $model]);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question