Here we explore how we write a wiki page that specifies both the controller code, and how that code is matched to a parameter such as a dropped url.
# Code on the page We can specifify code directly on the page. This is best done as the first code element on the page.
function parse_Url dURL, shortFile get "An audio from the commons..." put wikicommons_ConstructAudioPageArray ("Wikimedia Audio", it, dURL, shortFile) into pArray return pArray end parse_Url
We can also refere to remote code in a stack. Using a custom property is convenient.
the page_Array [dURL] of stack "Some Controller"
# Required parameters Each Controller Wiki would collect a number of pages that respond to the same parameter type.
Within Livecode we have a large number of contrllers that all pass a reference to a Livecode object as the first parameter.
In wiki, we expect a collection of controllers to respond to Dropped Urls, which means that the code on the wiki pages is expected to have dURL as the first parameter.
# Handler naming We use a standardised naming conventions here by providing a page_Array handler and a command that can be called by dispatch uniquely named after the handler so that handlers can be merged into a single script more easily.
# Execution We execute the code by either:
1. Fetching scripts from wiki pages and executing them directly, or 1. Loading a named controller and calling it in a standardised way.
# See