New class URL and API::getDestinationURL()
For a while now, many parts of library relied on function API::getDestinationURL($page). This function returns the valid URL which will point to specified page. However the implementation of this function was only working for absolute page names, and was built-in into API.
I am adding implementation which relies on a new class called URL. This class instance will be returned by getDestinationURL(). If you happen to pass this object to getDestinationURL again, it will not going to mess up the URL anymore.
Apart from that – additional syntax for relative pages is now allowed.
- pagename – will link to absolute page /pagename
- /pagename – same as above
- ./pagename – will link to a relative page. If our current page is users/add, then link will point to users/pagename
- ../pagename – will go one level up. You can use ../users to return from users/add to list of users.
URL generation supports sticky arguments and will also properly determine base URL. The returned URL will be absolute with “http://” (or https) in front.
3 Comments »
Leave a Reply
| Next »
-
Recent
- You have missed few posts!
- ATK4 Blog moved to its own domain. Please update.
- Checking password strength with CrackLib
- Creating beautiful URLs with Agile Toolkit
- Security model
- New features of DB and dsql planned for ATK 4.0
- Lightweight CMS in ATK (video)
- Reloading…
- Symfony 2.0 vs ATK3.8 – part 5 – Architecture and beyond
- Symfony 2.0 vs ATK3.8 – part 4 – Bundles, Users, DB
- Symfony 2.0 vs ATK3.8 – part 3 – The Controller
- Symfony 2.0 vs ATK3.8 – part 2 – The View
-
Links
-
Archives
- August 2010 (1)
- July 2010 (3)
- June 2010 (4)
- May 2010 (9)
- April 2010 (12)
-
Categories
-
RSS
Entries RSS
Comments RSS
This is long awaited update IMO. This method also messed up usage of ApiWEB in the past as I remember.
very cakey, I’d say.
jancha, actually other things work in a similar way. js chains convert themselves into strings. dynamic queries don’t but i think they should. Also echo $tempate should produce a rendered template.