phalcon-routing

Phalcon 4 documentation controller handler issue

≯℡__Kan透↙ 提交于 2021-02-08 10:18:42
问题 I'm Using Phalcon 4.0.6 on windows 10,x64bit with psr & php version is 7.4.7. I follow basic tutorial example from "https://docs.phalcon.io/4.0/en/tutorial-basic" but I'm getting error like: "Exception: SingleController handler class cannot be loaded". Is it phalcons problem or am i doing anything wrong? File Structure: [Bootstrap] <?php use Phalcon\Loader; use Phalcon\Di\FactoryDefault; use Phalcon\Mvc\View; use Phalcon\Mvc\Application; use Phalcon\Url; // Define some absolute path constants

Phalcon 4 documentation controller handler issue

☆樱花仙子☆ 提交于 2021-02-08 10:15:05
问题 I'm Using Phalcon 4.0.6 on windows 10,x64bit with psr & php version is 7.4.7. I follow basic tutorial example from "https://docs.phalcon.io/4.0/en/tutorial-basic" but I'm getting error like: "Exception: SingleController handler class cannot be loaded". Is it phalcons problem or am i doing anything wrong? File Structure: [Bootstrap] <?php use Phalcon\Loader; use Phalcon\Di\FactoryDefault; use Phalcon\Mvc\View; use Phalcon\Mvc\Application; use Phalcon\Url; // Define some absolute path constants

Phalcon PHP: Modify a request URL before it gets dispatched

孤者浪人 提交于 2020-01-14 01:38:09
问题 I'm looking for a way to modify a request URL before it gets dispatched. For instance, the following URLs should be handled by the same controller/action: /en/paris /de/paris /paris I would like to capture the country code if it is present, then rewrite the URL without it so that controllers don't have to deal with it. I tried the 'dispatch:beforeDispatchLoop' event but it doesn't seam to be designed for that. Any idea? 回答1: If you can convention that all country code comes first in the path,

Phalcon Multi module - Dynamic Module registration

白昼怎懂夜的黑 提交于 2020-01-02 10:08:17
问题 Hi guys Im using the following structure for a multi-module project in Phalcon [modules] [module1] [controllers] [models] [views] [module2] [controllers] [models] [views] [module-n] [controllers] [models] [views] I have registered only Module 1 and Module 2 in my bootstrap index.php file. Like this: $this->registerModules(array ( 'Module1' => array( 'className' => 'Modules\Module1\Module', 'path' => '../modules/module1/Module.php' ), 'Module2' => array( 'className' => 'Modules\Module2\Module'

How to add prefix to a controller in Phalcon PHP

半腔热情 提交于 2019-12-24 21:48:28
问题 I'm working on a website using Phalcon PHP that has an admin section mywebsite.com/admin I have created two different controller folders ( frontend-controllers & backend-controllers) an depending on the URL, I'm loading the right folder. I would like to add a prefix ( admin ) to the all backend controllers. mywebsite.com/admin/my-backend-controller-/myaction instead of mywebsite.com/my-backend-controller-/myaction I would like to know if it's possible and how to do it. 回答1: It is possible by

Phalcon router doesn't react to subfolders and namespace declaration

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 00:25:15
问题 So I've been reading a ton of stackoverflow and phalcon forum threads.. (I'm starting to hate this framework), but nothing seem to work and it doesn't explain why like Laravel does, for example. I'm just trying to be able to operate with this application structure: As you can see, all I want is to use namespaced controllers in subfolders to make more order for my code. According to all explanations, here's my loader.php: <?php $loader = new \Phalcon\Loader(); /** * We're a registering a set

PHP Phalcon Routing with file extension

我与影子孤独终老i 提交于 2019-12-12 04:22:01
问题 In my PHP Phalcon 3 Application I have a custom route: $router->add("/{chapter}/{name}.{type:[a-z]+}", array( "controller" => 'images', "action" => 'getFile', )); I test the application local with PHP Builtin Server, other routes are working regulary. If i test the route above: http://localhost:8000/XYZ/test.jpg I always get a 404. But in regards to the documentation it should work: https://docs.phalconphp.com/en/latest/reference/routing.html Do you have any idea whats wrong? This is my

Redirecting to 404 route in PhalconPHP results in Blank Page

烈酒焚心 提交于 2019-12-11 09:55:54
问题 I have setup a router, and in it, defined a route for 404s: <?php use Phalcon\Mvc\Router; $router = new Router(FALSE); $router->removeExtraSlashes(true); $route = $router->add('/', ['controller' => 'index', 'action' => 'index']); $route->setName("index"); // other routes defined here... $router->notFound([ "controller" => "index", "action" => "route404" ]); ?> My IndexController: <?php class IndexController extends ControllerBase { public function indexAction() { // code removd for berevity }

Phalcon PHP: Modify a request URL before it gets dispatched

倾然丶 夕夏残阳落幕 提交于 2019-12-06 15:50:31
I'm looking for a way to modify a request URL before it gets dispatched. For instance, the following URLs should be handled by the same controller/action: /en/paris /de/paris /paris I would like to capture the country code if it is present, then rewrite the URL without it so that controllers don't have to deal with it. I tried the 'dispatch:beforeDispatchLoop' event but it doesn't seam to be designed for that. Any idea? If you can convention that all country code comes first in the path, perhaps an additional rewrite rule can help you: <IfModule mod_rewrite.c> RewriteCond %{REQUEST_FILENAME} !