Templates Preferences
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 Code Assist function, and
select the template from the list. Templates are marked by a
icon. For more on using the code assist function, see 'Working
with Code Assist'.
The Templates Preferences page is accessed from Window | Preferences | PHP | 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 code 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. |
Note:
An imported template with the same name as a pre-existing template will overwrite (replace) the pre-existing one. In order to prevent a Template from being overwritten, you must rename the existing Template or edit the Template XML file to change the import name of the template.
|
|
|
To export a template:
|
An XML file will be created with the template information. |
Note:
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>
Click OK to apply your settings.
|
|
|
Related Links: |
|
|