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 »
- 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)
- 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