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

url('') function problem

Hi, url ('string') function and $url->setBaseUri('url') working perfectly concat url and string but, url('string') if have ":" character dont working return only string

example: https://paste.ubuntu.com/11922749/

I working with multi module application and active volt engine (centos 6)

edited Jul '15

Hi there :) First i need to question - what is that? ":"

I think u want to use router assignment? To do that, u must name what u use from router. For example

$router->add("/posts/{year}/{title}", "Posts::show")->setName("show-posts");
  • so important part here is ->setName("show-posts"); ...to use that in url function (in volt), now u can do something like this:
<a href="{{ url(['for' : 'show-posts', 'year': '2015', 'title' : 'test']) }}">Here</a>

Check documentation for more details: https://docs.phalcon.io/en/latest/reference/routing.html and https://docs.phalcon.io/en/latest/api/Phalcon_Mvc_Url.html

And good luck :)

PS: sorry for my English skills



3.7k

hi no ı dont want use any router :) I use baseUri because working with subdirectory. and {{url('someting')}} working perfect is return "baseUri/someting" but {{url('someting/example:example')}} return only "something/example:example". If have : character dont prepend baseUri

sorry for english and spelling ı use mobile now

Hm... i try and didnt have this issue.... what is your base uri? $url->setBaseUri(???);



3.7k

It's not important https://paste.ubuntu.com/11922749/

ı try other and real baseUri but problem is not solved

So, i got u.. :)

        <a href="{{ url('aaa/bbb') }}">TES</a>
        <a href="{{ url('aaa/bbb:ccc'|url_encode) }}">TES2</a>

Now works fine. Good luck.



3.7k
edited Jul '15

url encode replace ':' to '%' its not working with phalcon dispatcher parameters. maybe change ':' to '%' or other character solved problem. but this problem not have 1.x version. thanks for answer