From: Mike Taylor Date: Fri, 7 Nov 2014 16:09:54 +0000 (+0000) Subject: Finish writing up indirect parameters. X-Git-Tag: 1.0.0~56 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=b421fed5f8ec93e30e12ca12c0e9c7743801fa04;p=mkws-moved-to-github.git Finish writing up indirect parameters. --- diff --git a/doc/mkws-manual.markdown b/doc/mkws-manual.markdown index 78d1a49..6024760 100644 --- a/doc/mkws-manual.markdown +++ b/doc/mkws-manual.markdown @@ -1047,10 +1047,27 @@ customise the display than by providing a full HTML structure. ### Indirect settings The values of any setting are generally interpreted literally. However, it is possible to specify a value indirectly -- for -example, by reference to a query parameter -- and this is often useful in contexts such as specifying an autosearch query. FIXME -say more. +example, by reference to a query parameter -- and this is often useful in contexts such as specifying an autosearch +query. Settings of this kind have values beginning with an exclamation mark, and take the form `!`_type_`!`_value_. -FIXME !query!q, !path!2, etc. +The currently supported types are: + +* `param` -- uses the value of the specified query parameter for the URL. For example +`
` will auto-search for the word "sushi" if the page containing that widget is +invoked from the URL `http://example.com/magic/example.html?term=sushi` + +* `path` -- uses the value of the _n_th component of the URL path, as specified by the value. For example +`!path!3` will auto-search for the word "dinosaur" if the page containing that widget is +invoked from the URL `http://example.com/magic/lookup/dinosaur` + +* `var` -- uses the value of the named JavaScript global variable. This is a very powerful and general mechanism. For example, to + search for the reversed value of the query parameter called `reverseTerm`, you might write a JavaScript function to do the + extraction and reversing, the use the HTML: + + + + +
### Assembling Pazpar2 URLs