Transcluding

From ARK
Revision as of 13:48, 14 March 2014 by Jessogden (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

NOTE: As of ARK version equal to or greater than 1.1 transclusion is undertaken using the API - see transcludeSubform() and transcludeFilters(). The notes below are preserved as documentation for ARK versions prior to this. The basic HTML will work - but the data value will need to be updated to point at the appropriate API request string

Elements of ARK can be 'transcluded' - that is you can make a live query to your ARK and bring back the results of a Subform.

What this means is that subforms of a particular item (e.g a context) can be included in any other webpage - for example if you are entering an online blog and you want to show the photos of the special find you recovered today - then you can just include them and they will show up just as they show up when viewing them in ARK.

This starts getting very useful when you begin to think about a running site narrative, built within a webpage/blogging software/google documents. So when you are talking about the local matrix of a context - you can just transclude it straight into the document. Because this is running a live query against the database, you are getting the most up-to-date data and it will change as the original data is changed.

Its very easy to transclude in ARK. All you need to do is ensure whatever application you are in (e.g. Mediawiki, Blogger, TextPattern, etc.) can read raw html and the include the following in your page:

<object type="text/html" data="http://192.168.0.61:8080/ark/transclude_object.php?transclude=yes
  &sf_conf=conf_mcd_spat
  &sf_key=cxt_cd
  &sf_val=CH05SR_699
  &width=100%
  &height=100%">
  </object>
  • The web address that you put in the data field should point at your own version of ARK.
  • The sf_conf value is the name of the subform that you want to transclude - if you don't know this then you should contact your administrator.
  • The sf_key and sf_val are the itemkey and itemvalue of the item that you want to transclude. In this case we are transcluding the spatial subform for Context CH05SR_699.


Transcluding Filter Results

As of v0.7 (currently in SVN) it is possible to transclude results of saved filters as well. The code you need is as follows:

<object type="text/html" data="http://192.168.0.61:8080/ark/transclude_object.php?transclude=filter
  &filter=whorls
  &output_mode=tbl
  &width=100%
  &height=100%">
  </object>

This works in the same way as transcluding a subform except you can specify which saved filter and what output mode you want.

  • transclude=filter - this is essential to let the transclude script know you are transcluding a filter
  • filter=whorls - this can either be the saved name of the filter (i.e. 'whorls' or 'All Contexts') or it can be the number of the filter as saved in cor_tbl_filter.
  • output_mode=tbl - the output modes are 'tbl', 'chat' or 'map'