An excerpt from the ColdBox Docs:
- http://wiki.coldbox.org/wiki/URLMappings
- How about links on my pages?
- The best one is:
<a href="#event.buildLink('home.about')#">About</a>
When I place such a link/anchor on a .cfm page, the 'href' attribute
receives a fully qualified URL ! Now what I would like to have is:
Fully qualified URLs which I can build automatically standalone; to
use them in other contexts than just the 'href' attribute of links/
anchors. So the question is: Which ColdBox method can build those
fully qualified standalone URLs ?
SmartClient (Ajax) Components have attributes - NOT named 'href' -
which I assign values to at creation time; oftentimes, fully qualified
URLs are needed as attribute values; event.buildLink() alone isn't
enough ... Only if I use it for the 'href' attribute of links/anchors
a fully qualified URL seems to be automagically constructed by
ColdBox ...
You need to think about it this way, this will build a URL string that can be used anywhere that you need to use a url for, don’t think that it is only used for href.
Now do you understand why I asked for an example of why you are asking, because here is an example of me using it with extJs.
I now do it like so:
- <cfset loginURL = "#event.buildLink("general.about", true)#" />
- then assign the value of loginURL to a JavaScript variable
iscLoginURL
- then use the JavaScript variable iscLoginURL as the SmartClient
attribute value
- the value of iscLoginURL is: /index.cfm?event=General.About
- but in this case, it works for the SmartClient Component at hand:
Everything is relative
Thank You very much for Your efforts !
Should the need for fully qualified URLs arise in other scenarios, I
will come back to this thread !