We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

create project [name] in {{ link_to() }}

Hello,

I created a project using the devtools with "framework" as the project name (phalcon create-project framework)

I noticed that when I use volt's function link_to('./someController', 'Learn more'), the actual html link's href is mydomain.app/framework/someController, instead of mydomain.app/someController. I've been looking around in the initial files briefly how to override this setting, but did not find it (didn't have much time to hack through this).

I am using a custom vagrant box running debian 7 and a custom-configured nginx to work with Phalcon.

I am currently learning the framework so maybe it's a part I did not see yet in the documentation, but I seem to not have found anything in relation :(

Many thanks for your help :)

Happy flying!



1.4k
Accepted
answer
edited Mar '16

Basics :). This will be in your bootstrap file (public -> index.php), register services (config -> services.php), module config.. (apps -> module -> config -> config.php) module file (apps -> module -> Module.php).

As you generated it, it will be probably in Apps -> config -> config.php

You need to edit base Uri

'application' => array(
    'controllersDir' => __DIR__ . '/../controllers/',
    'modelsDir'      => __DIR__ . '/../models/',
    'migrationsDir'  => __DIR__ . '/../migrations/',
    'viewsDir'       => __DIR__ . '/../views/',
    'baseUri'        => '/'
)

Without DevTools you set it always with in your bootstrap file for example:

/**
* The URL component is used to generate all kinds of URLs in the application
*/
$di->setShared('url', function () use ($config) {
    $url = new UrlResolver();
    $url->setBaseUri($config->application->baseUri);

    return $url;
});

Hope it's clear. :)



1.1k

Oh silly me... If I hadn't had just 5 minutes I would have found it...!

Thank you very much for your detailed answer and for your help :)!