diff --git a/README.md b/README.md index 7c5bafa..7a46a4a 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,12 @@ Если запрошенному URL не соответствует ни один объявленный маршрут, будет сгенерированна 404 ошибка. +Чтобы запрос не вошел в рекурсию при использовании в своих сниппетах и компонентах метода `sendErrorPage`, необходимо передать в метод `array('stop' => true)`. Должно получится вот так: + +```php +$modx->sendErrorPage(array('stop' => true)); +``` + Все именнованные параметры попадут в массив `fastrouter` в глобальном массиве `$_REQUEST`. В нашем случае по первому маршруту, например `http://site.com/fastrouter/vanchelo/10` получим вот такие данные: ```php var_dump($_REQUEST); diff --git a/core/components/fastrouter/elements/plugins/plugin.fastrouter.php b/core/components/fastrouter/elements/plugins/plugin.fastrouter.php index 64874b2..bfb0c92 100644 --- a/core/components/fastrouter/elements/plugins/plugin.fastrouter.php +++ b/core/components/fastrouter/elements/plugins/plugin.fastrouter.php @@ -3,7 +3,7 @@ $router = new FastRouter($modx); -if ($modx->event->name == 'OnPageNotFound') { +if ($modx->event->name == 'OnPageNotFound' && !isset($modx->event->params['stop'])) { $router->dispatch(); } else if ($modx->event->name == 'OnChunkSave' && $chunk->name == 'fastrouter') { $router->clearCache();