Answer the question
In order to leave comments, you need to log in
Why does one rule for different post categories url in Yii2 not work correctly?
'rules' => [
''=>'site/index',
'sitemap.xml' => 'sitemap/index',
'<module:\w+>/<uri:\w+>' => '/<module>/default/view',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<action:\w+>'=>'site/<action>',
]
//------- вывожу вид
//------- данные внизу одинаковы для разделов УСЛУГИ и БЛОГ
use Yii;
...
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\web\UploadedFile;
use yii\helpers\Url;
public function actionView($uri)
{
$model = $this->render('view', [
'model' => Posts::findOne(['url' => $uri]),
]);
return $model;
}
// 404
public function actionView($uri)
{
$model = $this->render('view', [
'model' => Services::findOne(['url' => $uri]),
]);
return $model;
}
Answer the question
In order to leave comments, you need to log in
I don't know what the joke was. in general, the site was on tilde, of course, under tilde, there was no desire to make a cool admin panel, in general, transferred the database and the entire site .. Apparently, records from a different site somehow incorrectly affected the work and the moderator somehow crookedly filled in general when deleting records from db and creating new ones worked)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question