Pregunta

I am following the tutorial on OS X 10.8 with PHP 5.3, phalcon 0.5.0. I have a folder called tutorial in the web root of my apache. When I use the code:

echo Phalcon\Tag::linkTo("signup", "Sign Up Here!");

In the output html I am getting

localhost/signup 

instead of

localhost/tutorial/signup

I also entered RewriteBase /tutorial/ in my .htacess file, but still having the same problem. I had the same issue in 0.4 of phalcon and also in 0.5

¿Fue útil?

Solución

The URL rewrite will need to be registered in the DI container of your project during bootstrap as such (file public/index.php)

// Setting up the view component
$di->set(
    'url', 
    function() {
        $url = new \Phalcon\Mvc\Url();
        $url->setBaseUri('/tutorial/');
        return $url;
    }
);

This will effectively instruct Phalcon to use the subfolder internally as well as the \Phalcon\Tag::linkTo() function. Please note the ending slash "/" character in the setBaseUri()

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top