Answer the question
In order to leave comments, you need to log in
The logic of your own routing?
Kind. I really wanted to experiment with my own CMS, and how everything works ... I read a lot, but after all the posts my head went round.
So there is YII2. Everything is standard.
There is a page table. ( ID, Content, Url ).
Created action in SiteController
public function actionParseurl( $path = 'nothing') {
print_r( YII::$app->request->get() );
echo '<hr style="border:0px; border-top: 1px dotted #ccc;">';
if ( tPages::pageExists( $path ) ) { // Проверка на существование страницы
return tPages::getPage( $path ); // Получение CONTENT и показ на экране.
} else {
return tPages::getPage( 'error' ); // Иначе показать ошибку (404)
}
}
'rules' => [
'/<path:\w+>' => 'site/parseurl',
],
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question