Location

Create or find a location.
location [locator [site [:if-exists y-action][:if-does-not-exist n-action]]]

This function gets the current location if called without any arguments in the context of a request. If a name is specified, it searches for a matching location in the current site. The argument can be a URL string, a locator or the pathname to a file.

If the argument is a string, the location function location searches for a location with a corresponding locator. If given a pathname, it will return the first location that uses the document of the file. If the argument is a location, the location itself will be returned.

The :if-does-not-exist keyword control what happens when a matching location doesn't exist. By default, the function returns NIL. If the keyword value is :create, the function creates and returns a new location.

The :if-exists keyword controls what happens when the location already exists. By default, the function returns the location. If the keyword value is :error, the function will signal an error.

The returned value is a location object, or NIL if no location matches the name.

(location)
(location "index")
(location "index" "www.in-progress.com")
(location "index" NIL :if-does-not-exist :create)
(title (location "index"))

Related: entity; title; description; with-location; with-open-dom

Interaction Developer Reference


This site is enhanced with Interaction.