blob: becd34a6fbe805ae1cf5d2d871db13e0fc8a0f75 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="generator" content="Adobe RoboHelp 8">
<title>Templates</title>
<link rel="StyleSheet" href="default.css" type="text/css">
<style type="text/css">
<!--
body { border-left-style:None;
border-right-style:None;
border-bottom-style:None;
background-color:Transparent;
border-top-style:None; }
-->
</style>
<style type="text/css">
<!--
body { border-left-style:None;
border-right-style:None;
border-bottom-style:None;
background-color:Transparent;
border-top-style:None; }
-->
</style>
<script type="text/javascript" language="JavaScript">
//<![CDATA[
function reDo() {
if (innerWidth != origWidth || innerHeight != origHeight)
location.reload();
}
if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
origWidth = innerWidth;
origHeight = innerHeight;
onresize = reDo;
}
onerror = null;
//]]>
</script>
<style type="text/css">
<!--
div.WebHelpPopupMenu { position:absolute;
left:0px;
top:0px;
z-index:4;
visibility:hidden; }
p.WebHelpNavBar { text-align:right; }
-->
</style>
<script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>
<script type="text/javascript" language="javascript" src="whver.js"></script>
<script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>
<script type="text/javascript" language="javascript1.2" src="whutils.js"></script>
<script type="text/javascript" language="javascript1.2" src="whlang.js"></script>
<script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>
<script type="text/javascript" language="javascript1.2">//<![CDATA[
<!--
if (window.gbWhTopic)
{
var strUrl = document.location.href;
var bc = 0;
var n = strUrl.toLowerCase().indexOf("bc-");
if(n != -1)
{
document.location.href = strUrl.substring(0, n);
bc = strUrl.substring(n+3);
}
if (window.setRelStartPage)
{
addTocInfo("Reference\nPHP Preferences\nEditor Preferences\nTemplates Preferences");
addAvenueInfo("Reference","task_tags.htm","typing.htm");
}
document.write("<p style=\"text-align:left\"> ");
AddMasterBreadcrumbs("ide_help.htm", "", "&gt;", "Home", "pdt_table_of_contents.htm");
document.write("<a href=\"reference.htm\">Reference<\/a> &gt; <a href=\"preferences.htm\">PHP Preferences<\/a> &gt; <a href=\"editor.htm\">Editor Preferences<\/a> &gt; Templates Preferences<\/p>");
if (window.setRelStartPage)
{
setRelStartPage("ide_help.htm");
autoSync(0);
sendSyncInfo();
sendAveInfoOut();
}
}
else
if (window.gbIE4)
document.location.reload();
//-->
//]]></script>
</head>
<body leftmargin="5" topmargin="5" rightmargin="5" bottommargin="5"><script type="text/javascript" language="javascript1.2">//<![CDATA[
<!--
if (window.writeIntopicBar)
writeIntopicBar(4);
//-->
//]]></script>
<div style="width: 100%; position: relative;" id="header">
<p align="right"><a
title="Documentation Survey" href="http://spreadsheets.google.com/viewform?formkey=dC1scEswTjFia2tDQ3Y5TVJBbkNQcWc6MQ">Documentation
Survey</a>
| <a href="javascript:crlf=&quot;&quot;;h=location.href;t=document.title;e = &quot;&quot; + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text); if (e!=null) location=&quot;mailto:documentation@zend.com&quot; + &quot;?Subject= Feedback on PDT for page &quot; + escape(t) + &quot;&amp;Body=&quot; + escape(e).replace(/ /g, &quot;+&quot;) + crlf + &quot; &quot;; void 0"><span
style="background-color: #ffffff;">Submit Documentation</span><span
style="background-color: #ffffff;"> Feedback</span></a><span
style="background-color: #ffffff;"></span><span style="background-color: #ffffff;">
</span><span style="background-color: #ffffff;">|
</span><span
style="background-color: #ffffff;"><a title="View Latest Version and Get PDF Online"
href="http://www.zend.com/en/resources/zend-documentation/"
target="_blank">View Latest
Version and Get PDF Online</a></span></p>
</div>
<h1>Templates
Preferences</h1>
<p><span style="text-align: left;">The Templates Preferences page allows
you to create, edit, delete, import and export templates.</span></p>
<p>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.</p>
<p>&#160;</p>
<p>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 <img src="template_icon.png" alt="template_icon.png" style="border: none;" width="19" height="20" border="0"> icon.
For more on using the content assist function, see <a href="working_with_code_assist.htm">Working
with Content Assist</a>.</p>
<p>&#160;</p>
<p>The Templates
Preferences page is accessed from <span style="font-weight: bold;"><b>Window
| Preferences | PHP | Templates
</b></span>.</p>
<p class="picture"><img src="template_preferences_pdt.png" alt="Template Preferences Page" title="Template Preferences Page" style="border: none;" width="497" height="510" border="0"></p>
<p>To remove a template from the list of available options, unmark its
checkbox in the list.</p>
<p>To edit an existing template, select it from the list and click Edit.</p>
<h3><a name="Adding_new_templates" id="Adding_new_templates"></a>Creating
a new Template</h3>
<p>This procedure describes how to create a new template to be added to
the template list.</p>
<table cellspacing="0" width="100%">
<col style="width: 7.093%;">
<col style="width: 92.907%;">
<tr style="vertical-align: top;">
<td style="width: 7.093%; padding-right: 10px; padding-left: 10px;"><p
style="font-size: 6pt;">&#160;</p></td>
<td style="width: 92.907%; padding-right: 10px; padding-left: 10px;"><p
style="font-weight: bold;">&#160;</p></td>
</tr>
<tr style="vertical-align: top;">
<td style="width: 7.093%; padding-right: 10px; padding-left: 10px;"><p
style="font-size: 6pt;"><img src="ref_icon.png" alt="Instructions on how to complete a procedure" title="Instructions on how to complete a procedure" style="border: none;" width="28" height="33" border="0"></p></td>
<td style="width: 92.907%; padding-right: 10px; padding-left: 10px;"><p
style="font-weight: bold;">To create a new template:</p>
<ol type="1">
<li class="p" style="margin-left: -20px;"><p>Click New.</p></li>
<li class="p" style="margin-left: -20px;"><p>The New Template
dialog will open.</p></li>
</ol>
<p class="picture"><img src="template_new_pdt.png" alt="New Template Dialog" title="New Template Dialog" style="border: none;" width="507" height="276" border="0"></p>
<ol start="3" type="1">
<li class="p" style="margin-left: -20px;"><p>Enter the template's
details:</p></li>
</ol>
<ul type="square">
<li><p>Name - &#160;A short name to identify the template (e.g.
'while' for a template for a while loop).</p></li>
<li><p>Context - &#160;The code context when the template will
be available (PHP, PHPDoc, New PHP ). e.g. PHP templates
will only be available for use when writing PHP code.</p></li>
<li><p>Description - A short description of the template's
code.</p></li>
<li><p>Pattern - The pattern is the actual code string that
will be inserted into the editor whenever this template is
selected.<br>
Use the Insert Variable button to select from a list of common
variables.</p></li>
</ul>
<ol start="4" type="1">
<li class="p" style="margin-left: -20px;"><p>Click OK.</p></li>
</ol></td>
</tr>
<tr style="vertical-align: top;">
<td colspan="2" style="width: 100%; padding-right: 10px; padding-left: 10px;"><p>Your
template will be added to the list and will be available from
the Content Assist in the relevant context.</p></td>
</tr>
</table>
<h3>Exporting and Importing Templates</h3>
<p>PDT enables
you to export and import Templates, created within XML files in the following
format:</p>
<p>&#160;</p>
<p class="code">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;
?&gt;</p>
<p class="code">&lt;templates&gt;</p>
<p class="code">&lt;template autoinsert=&quot;true&quot; context=&quot;php&quot;
deleted=&quot;false&quot; description=&quot;description&quot; enabled=&quot;true&quot;
name=&quot;for&quot;&gt;</p>
<p class="code">for($$i = 0; $$i &lt; 1; $$i++){ }</p>
<p class="code">&lt;/template&gt;</p>
<table cellspacing="0" width="100%">
<col style="width: 7.093%;">
<col style="width: 92.907%;">
<tr style="vertical-align: top;">
<td style="width: 7.093%; padding-right: 10px; padding-left: 10px;"><p
style="font-size: 6pt;">&#160;</p></td>
<td style="width: 92.907%; padding-right: 10px; padding-left: 10px;"><p
style="font-weight: bold;">&#160;</p></td>
</tr>
<tr style="vertical-align: top;">
<td style="width: 7.093%; padding-right: 10px; padding-left: 10px;"><p
style="font-size: 6pt;"><img src="ref_icon.png" alt="Instructions on how to complete a procedure" title="Instructions on how to complete a procedure" style="border: none;" width="28" height="33" border="0"></p></td>
<td style="width: 92.907%; padding-right: 10px; padding-left: 10px;"><p
style="font-weight: bold;">To import a template:</p>
<ol type="1">
<li class="p" style="margin-left: -20px;"><p>Click Import to
open the Import Template's browser.</p></li>
<li class="p" style="margin-left: -20px;"><p>Select the location
to import the relevant XML file containing the template information.</p></li>
<li class="p" style="margin-left: -20px;"><p>Click Open.</p></li>
</ol></td>
</tr>
<tr style="vertical-align: top;">
<td colspan="2" style="width: 100%; padding-right: 10px; padding-left: 10px;"><p>The
templates contained in the template.xml file will be imported
into the list of Templates.</p></td>
</tr>
</table>
<table cellspacing="0" width="100%">
<col style="width: 7.093%;">
<col style="width: 92.907%;">
<tr style="vertical-align: top;">
<td style="width: 7.093%; padding-right: 10px; padding-left: 10px;"><p
style="font-size: 6pt;">&#160;</p></td>
<td style="width: 92.907%; padding-right: 10px; padding-left: 10px;"><p
style="font-weight: bold;">&#160;</p></td>
</tr>
<tr style="vertical-align: top;">
<td style="width: 7.093%; padding-right: 10px; padding-left: 10px;"><p
style="font-size: 6pt;"><img src="ref_icon.png" alt="Instructions on how to complete a procedure" title="Instructions on how to complete a procedure" style="border: none;" width="28" height="33" border="0"></p></td>
<td style="width: 92.907%; padding-right: 10px; padding-left: 10px;"><p
style="font-weight: bold;">To export a template:</p>
<ol type="1">
<li class="p" style="margin-left: -20px;"><p>Select the template(s)
for export from the Template list.</p></li>
<li class="p" style="margin-left: -20px;"><p>Click Export to
open the Export Template's dialog.</p></li>
<li class="p" style="margin-left: -20px;"><p>Select the location
to save the XML file to.</p></li>
<li class="p" style="margin-left: -20px;"><p>Click Save.</p></li>
</ol></td>
</tr>
<tr style="vertical-align: top;">
<td colspan="2" style="width: 100%; padding-right: 10px; padding-left: 10px;"><p>An
XML file will be created with the template information.</p></td>
</tr>
</table>
<p class="Note">Note:</p>
<p class="NoteText">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: &lt; template &gt; &lt;/template&gt;</p>
<table cellspacing="0" width="100%">
<col style="width: 7.093%;">
<col style="width: 92.907%;">
<tr style="vertical-align: top;">
<td style="width: 7.093%; padding-right: 10px; padding-left: 10px;"><p
style="font-size: 6pt;">&#160;</p></td>
<td style="width: 92.907%; padding-right: 10px; padding-left: 10px;"><p>&#160;</p></td>
</tr>
<tr style="vertical-align: top;">
<td style="width: 7.093%; padding-right: 10px; padding-left: 10px;"><p
style="font-size: 6pt;"><img src="link_icon.png" alt="link_icon.png" style="border: none;" width="32" height="40" border="0"></p></td>
<td style="width: 92.907%; padding-right: 10px; padding-left: 10px;"><p
style="font-weight: bold;">Related Links:</p>
<p><a href="using_templates.htm">Using
Templates </a></p>
<p><a href="preferences.htm">PHP Preferences</a> </p>
<p><a href="code_assist_concept.htm">Content Assist</a>
</p></td>
</tr>
<tr style="vertical-align: top;">
<td style="width: 7.093%; padding-right: 10px; padding-left: 10px;"><p
style="font-size: 6pt;">&#160;</p></td>
<td style="width: 92.907%; padding-right: 10px; padding-left: 10px;"><p>&#160;</p></td>
</tr>
</table>
<div style="width: 100%; position: relative;" id="footer">
<p style="text-decoration: underline; "
align="center">PHP Development
Tools</p>
</div>
<script type="text/javascript" language="javascript1.2">//<![CDATA[
<!--
if (window.writeIntopicBar)
writeIntopicBar(0);
highlightSearch();
//-->
//]]></script>
</body>
</html>