Templates

From Ketarin
Jump to: navigation, search

An application template is basically an application, where some information is still missing. Typically, a template allows you to download an application of your choice from a website which offers a plethora of downloads, like softpedia.com, by only using the template plus some information like the application name.

How to create a template

If you want to create (and possibly share) application templates, you can export an existing application as template by choosing “Application Template” as output file type for File → Export. After that, you can add placeholders to the exported XML. When a user imports an application template with placeholders, he will be asked to insert values for them.To add a placeholder, just add:

<placeholder name="This will be shown to the user" />

...to the exported XML. You can add as many as you like. The user will only be prompted once for multiple placeholders with the same name. The following attributes for the placeholder XML element are available:

Name Description Version Required
name Name of the placeholder, each name will be prompted only once. Also, the text will be shown to the user as prompt. 1.1
options Specifies a list of options, separated by a pipe ("|"). Instead of a text box, a combo box with dropdown is shown so that the user can select one of the given values. 1.1
regex Specifies a regular expression which is to be applied to the user entered value. The result of the regular expression is used instead of the value. 1.1
value Default value, user does not have to enter a value to proceed. 1.1
variable Upon creation of the template, Ketarin attempts to resolve the specified (without braces) variable and use the resulting value for this placeholder. If the variable cannot be determined (no internet connection etc.), the user is asked to enter a value manually. 1.5

Prototype templates (since 1.5)

Sometimes, it may be necessary to adjust an application template to changes of the website it has been created for. If you change the template, you would have to re-create all applications from the new template though, which is quite tedious. In order to prevent that, you can attach a random GUID to a template which has placeholders:
<ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx">

If you then ever import a changed template with the same GUID, Ketarin will ask whether or not to update existing applications with a new template.

How to use a template

Click FileImport, then select the XML file that contains the template. You will be prompted for all necessary placeholders. You can find many templates in the forum.