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

Hi,

In the html <a> element the href attribute can be for absolute or relative urls.

I would like to use:

echo $this->tag->linkTo($page->before,'<');

The problem I am having is this results in:

<a href="/myBaseUrl/5"> < </a>

When I need:

<a href="5"> < </a>

Is there a way to use $this->tag->linkTo in relative mode?



98.9k
Accepted
answer

Try this way:

echo $this->tag->linkTo(array($page->before,'<', 'local' => false));


47.7k

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?