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

$this->tag->linkTo for relative uri in phalcon 2.0.3

This no longer appears to work in Phalcon 2.0.3. My baseUri is appearing in the href.

echo $this->tag->linkTo(array($page->last,'>>', 'class' => 'paginator-button', 'local' => false));

Can anyone confirm?



4.0k
edited Jun '15

With latest phalcon version

echo $this->tag->linkTo(array('/page/next', '>>', 'local' => false, 'class' => 'paginator-button'));
//output 
<a href="/page/last" class="paginator-button">>></a>
echo $this->tag->linkTo(array('/page/next', '>>', 'local' => true, 'class' => 'paginator-button'));
<a href="/baseUri/page/next" class="paginator-button">>></a>


47.7k

I'm getting the same result with:

echo $this->tag->linkTo(array($page->last,'>>', 'local' => false, 'class' => 'paginator-button'));

Still seeing the baseUri in the href.



4.0k

Can you post output?

var_dump($this->tag->linkTo(array($page->last,'>>', 'local' => false, 'class' => 'paginator-button')));
var_dump($this->tag->linkTo(array($page->last,'>>', 'local' => true, 'class' => 'paginator-button')));
exit;


47.7k

Here you go. Does this work for you? I could do with a sanity check. I'd like to know if I have a config issue or a bug or something else.

I am using a compiled version of phalcon 2.0.3 on mac yosemite.

echo var_dump($this->tag->linkTo(array($page->last,'>>', 'local' => false, 'class' => 'paginator-button')));
" string(56) ""<a href=​"/​baseUri/​86" class=​"paginator-button">​>>​</a>​ "" "

==========================================

echo var_dump($this->tag->linkTo(array($page->last,'>>', 'local' => true, 'class' => 'paginator-button')));
" string(56) "" <a href=​"/​baseUri/​86" class=​"paginator-button">​>>​</a>​ "" "


4.0k

Yes. It's work for me. I am using zephir for phalcon compilation.

Zephir

$ git clone https://github.com/phalcon/zephir.git
$ cd zephir
$ ./install-json && sudo ./install -c

Phalcon

$ git clone git://github.com/phalcon/cphalcon.git
$ cd cphalcon
$ git checkout 2.0.x
$ zephir build
Copying new kernel files...
Preparing for PHP compilation...
Preparing configuration file...
Compiling...
Password:
Extension installed!
Don't forget to restart your web server
$ sudo apachectl restart
$ zephir stubs #generate stubs for IDE in <zephir directory>/ide/

-- My software info: MacOSx 10.10, PHP 5.5.18, Zephir version 0.7.0b



47.7k

Do you have baseUri set in your application config?



4.0k

Yes

return new \Phalcon\Config(array(
    'database'    => array(
        'adapter'  => 'Mysql',
        'host'     => '127.0.0.1',
        'username' => 'root',
        'password' => 'root',
        'dbname'   => 'test',
        'charset'  => 'utf8',
    ),
    'application' => array(
        'publicDir' => __DIR__ . '/../../public/',
        'cacheDir' => __DIR__ . '/../../app/cache/',
        'baseUri'  => '/baseUri',
    ),
));
var_dump($this->tag->linkTo(array('/page/last','>>', 'local' => false, 'class' => 'paginator-button')));
var_dump($this->tag->linkTo(array('/page/last','>>', 'local' => true, 'class' => 'paginator-button'))); exit;
<a href="/page/last" class="paginator-button">>></a>
<a href="/baseUri/page/last" class="paginator-button">>></a>