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

Wrong generated path by stylesheetLink() or javascriptInclude() when working inside userdir

I'm testing under the url 'https://localhost/~kiang/biz/'

When trying to use Volt,

{{ stylesheet_link("bootstrap/css/bootstrap.min.css") }}

be compiled as

<?php echo Phalcon\Tag::stylesheetLink('bootstrap/css/bootstrap.min.css'); ?>

and returned

<link rel="stylesheet" href="/biz/bootstrap/css/bootstrap.min.css" type="text/css" />

The '/~kiang' was missing.

What is your baseUri set to?

$this->di['url'] = function () {
            $url = new \Phalcon\Mvc\Url();
            $url->setBaseUri("/~kiang/");
            return $url;
        };


2.1k

Thanks. I didn't know about this setting before.

My site is giving this error when mounting, only now I configured like this:

$di->set('url', function() use ($config){ $url = new \Phalcon\Mvc\Url(); $url->setBaseUri($config->application->baseUri); return $url; });

And put in config.ini: baseUri = /testeapp/

Only instead of riding www.testeapp.com/css he rides www.testeapp.com/testeapp/css and gives error, this error only occurs in production



98.9k

@André it seems that $config->application->baseUri is null or empty, can you check that?

I took a die and correctly returns the set value in config.ini /testeapp/ , the production server is linux and windows site is.



98.9k

Ah, baseUri must be "/" in production