UPK - Customizing Templates
By Maria Cozzolino on Aug 16, 2010
One of the ways UPK helps you rapidly develop content is by providing standard text for common actions. Instead of having to type most of the screen interactions (e.g. Click the Print button), the UPK system fills in that information for you. This information is contained in our template file. Since template text is translated into all Player languages, you get the added bonus of a jump-start for your translation projects.
Basically, template text consists of a combination of an Action, an Object and the Object name. Using our example above: Click the Print Button. The action is "Click", the object is "button" and the object name is "Print". The template contains all this text, so it can be concatenated into a sentence.
If you wish to change the template text, there are a couple ways to do it:
1. Change for individual frame. If you want to change the template text for a single frame only, you can bring the template text inline in the topic editor, and edit it like you edit custom user text in the frame properties pane. This has no impact on the rest of the topics.
2. Change for all frames. If you want to change the template text for all frames, you can edit the template itself. All topics that use the edited template will have the new values. You can edit the template by working directly with the .xml file. For those of you like me who don't have a degree in reading XML, there also is an external Template Editor that puts the templates in a more readable UI.
Before we go changing the template text, let's do some basic housekeeping. I tell you this in every blog post, so you know what's coming. Make a copy of the existing template. This backup serves two purposes. First, it gives you a fall-back in case something happens. Second, when you upgrade to a newer version of the software, the standard templates will be updated. Making a copy ensures that your template changes will remain intact.
Now we can start. From the developer, open up the copy of your template package, and copy the template.xml to your desktop. The template editor is installed in the same location as your developer client. When you run the template editor, you need to open a template file to edit. Select the file from your desktop.
The top portion of the Template Editor shows the objects (called Classes in the template.xml file). Making a change to any of these items will change the name in all instances it appears.
In the middle are the various actions that can be performed on an object, along with the corresponding template text. There is a preview at the bottom, so you can see the text you're building. Items that appear in bold are unique for the specific action/object combination (these are known as local templates). Updates to the bold items will affect this action/object combination only. All other items (non-bold) are applicable to the whole system. Changes here will affect all instances where the specific action is performed. Note that the local templates override the system settings, so if you change a system template, you still may have to update the local templates for that action.
Let's say you want to change the template text from Click the Print button to Press the Print button.
1. You would first find the button object, which is near the bottom of the class list.
2. Next, select the action for clicking - in this case LClick1, which stands for a single left-click on the object.
3. Highlight the row labeled "Text".
4. Double-click the text that appears in the middle of the template editor, and a dialog opens that allows you to edit the text.
5. Make your edits, and close the dialog. In our example, change the word "Click" to "Press".
6. Notice that the preview updates to show you a sample of the new template text.
7. Save your template.xml
8. Copy it back to your newly created package, and save the package.
Now when you view your topics, you will see the new template text.
You can also use the template text editor to change the standard instructional text that appears on start and end frames as well as in Know It mode. For more details on how to customize the template text, see the section in the Content Development Manual entitled "Customize Templates"
What kind of modifications do you make to your templates? Are there objects that should have different text? Feel free to discuss in the comments.