The Templates Preferences page allows you to create, edit, delete, import and export templates.
Templates are shortcuts used to insert a pre-defined framework of code. The purpose is to save time and reduce the potential for errors in standard, repetitive code units. Once a template is inserted, you can complete the code quickly using manual and automated code entry methods.
To insert a template into your code, enter the first few letters of its name and press Ctrl+Space to activate the Content Assist function and open the content assist list. Select the required template from the list. Templates are marked with a icon. For more on using the content assist function, see Working with Content Assist.
The Templates Preferences page is accessed from Window | Preferences | PHP | Editor | Templates.
To remove a template from the list of available options, unmark its checkbox in the list.
To edit an existing template, select it from the list and click Edit.
This procedure describes how to create a new template to be added to the template list.
To create a new template:
Your template will be added to the list and will be available from the Content Assist in the relevant context.
PDT enables you to export and import Templates, created within XML files in the following format:
<?xml version="1.0" encoding="UTF-8" ?>
<templates>
<template autoinsert="true" context="php" deleted="false" description="description" enabled="true" name="for">
for($$i = 0; $$i < 1; $$i++){ }
</template>
To import a template:
The templates contained in the template.xml file will be imported into the list of Templates.
To export a template:
An XML file will be created with the template information.
If you selected more than one template to export, all of them will be present in the exported XML file. Each of the original Templates is bounded by: <template> </template>