Answer the question
In order to leave comments, you need to log in
How to trim attribute length for a slug?
Good afternoon. You need to cut off the title of the article and give the resulting line for saving for slugs. I act as follows:
public $strTitle;
public function getSlug () {
$this->strTitle = mb_substr($this->title, 0, 59);
return $this->strTitle;
}
public function behaviors()
{
return [
[
'class' => SluggableBehavior::className(),
'attribute' => 'strTitle',
'slugAttribute' => 'slug',
],
];
}
Answer the question
In order to leave comments, you need to log in
In the model, set the "value" property
public function behaviors()
{
return [
[
'class' => SluggableBehavior::class,
//'attribute' => 'title',
'value' => function($event){
return mb_substr($this->title, 0, 5);
}
]
];
}
Создаем файл mobile.css , пишем в него код:
@media only screen and (min-width: 600px) and (max-width: 1023px) {
body {color:#fff}
header {background-color:red;}
}
body {color:#fff}
и header {background-color:red;}
Вот на оф.сайте информация - клик
А вообще бы Вы сначала до ума довели desktop версию. Горизонтальный скрол, поехавшие блоки. Фиксите.
Bootstrap has responsiveness out of the box and is implemented through grid:
getbootstrap.com/css/#grid-media-queries
What's the problem?
Here you have types of cakes in your code, they have class="col-md-3" and why not do class="col-xs-12 col-sm-6 col-md-3" - it will be adaptive, including same spirit with the rest.
Well, the header is the same or without bootstrap using media queries.
If you want rubber, try to minimize fixed values like px, and use % or vh,vw,rem and other relative units. A case in point is your logo. It looks terrible on small displays.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question