Answer the question
In order to leave comments, you need to log in
How to make url displayed inline in YII2?
I have a URL rule, but I can't get it to convert the URL to string form. Since the site actually creates duplicate pages.
public function actionP($category, $brand, $product) {
$model = Product::getBolleanProduct($category, $brand, $product);
if($model['product_id'] && $model['category_id'] && $model['manufacturer_id']) {
return $this->getProduct($model['product_id'], $category, $brand, $product);
} else {
throw new \yii\web\HttpException(404, '404! Товар не найден');
}
}
Answer the question
In order to leave comments, you need to log in
So I decided, of course, the method is rude, but it works
public function actionP($category, $brand, $product) {
$model = Product::getBolleanProduct($category, $brand, $product);
if($model['product_id'] &&
$model['category_id'] &&
$model['manufacturer_id'] &&
$product === strtolower($product) &&
$brand === strtolower($brand) &&
$category === strtolower($category)) {
return $this->getProduct($model['product_id'], $category, $brand, $product);
} else {
throw new \yii\web\HttpException(404, '404! Товар не найден');
}
}
blabla/< category>/< brand>/< product> => blabla/shop/P
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question