Agile Toolkit news

library updates, tips, information and more

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.


April 17, 2010 - Posted by | Core changes, Version 3


  1. This is long awaited update IMO. This method also messed up usage of ApiWEB in the past as I remember.

    Comment by Svetlozar Kondakov | April 19, 2010 | Reply

  2. very cakey, I’d say.

    Comment by jancha | April 20, 2010 | Reply

  3. 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.

    Comment by romaninsh | April 21, 2010 | Reply

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s