Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

IndexController actions (Routing) + managing img with volt

Hi, I'm newbie, this my first Phalcon projectm and it's small. For now I have only a couple pages, so I decided to put all actions in the IndexController. That's fine, but since I want the url to be:

http://127.0.0.1/statuts not: http://127.0.0.1/index/statuts

To solve this trouble, I had created app/config/router.php with this content:

use Phalcon\Mvc\Router;

// Create the router $router = new Router();

// Define statuts route $router->add( "/statuts", array( "controller" => "index", "action" => "statuts" ) );

$router->handle();

and adding this in the index.php:

/**
 * Read routes
 */
include APP_PATH . "/app/config/router.php";

The try wasn't a success! So her is my first question. How can i hack the routing so i don't need to put the index as controller name on the uri.

Also, this do not show any image: {{ image("img/exemple.png", "alt": "alternative text") }} all the images are locate in public/img and i'm using nginx with this configuration :

location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
    root /home/ibou/esaf/public;
}

Some help please


19.5k
Accepted
answer

Hi Levano,

for the image path, please check your permissions, i am also working on Mac and that is almost a problem.

Your other question i can't understand, why you put everything in 1 controller? I am using vokuro and before that invo, maybe you can understand the structure a little bit better there.

Rgds

Stefan