Netbeans template Configuration

Source: Internet
Author: User
Tags netbeans
ArticleDirectory
    • Can you give me a list of all the predefined variables for templates, like $ {user} and $ {date }?
Original article: Workshop.
When creating a PHP file:

<? PHP
/**
* Encoding: UTF-8
* Created on: 14:48:40 by smallchicken, microji@126.com
*/
?>

Tool-template-open the "php file" in PHP and open it in the editor,
OK. You can edit the template file.
Of course, variables such as the write time and file name must be configured separately.

<? PHP
/**
* Encoding: $ {encoding}
* Created on: $ {date }$ {time} by $ {author}, $ {email}
*/

?>
Variables must be opened in the editor in tool -- template -- User Configuration Attribute -- user. properties.
Email = microji@126.com
Author = smallchicken
$ {Date? Date? String ("yyyy-m-d ")}
$ {Time? Time? String ("H: I: s ")}

Write the variable.
The format of date and time is the same as that of PHP,
Variable names can be customized.

List of official template variables:
Http://wiki.netbeans.org/FaqTemplateVariables

Can you give me a list of all the predefined variables for templates, like $ {user} and $ {date }?
    • $ {Date} inserts the current date, in this format: Feb 16,200 8
    • $ {Encoding} inserts the default encoding, such as: UTF-8
    • $ {Name} inserts the name of the file.
    • $ {Nameandext} inserts the name of the file, together with its extension.
    • $ {Package} inserts the name of the package where the file is created.
    • $ {Time} inserts the current time, in this format: 7:37:58
    • $ {User} inserts the user name.
    • $ {Project. License} Based on the value (e.g., 'cddl '), the license header is found and is inserted into the template.
    • $ {Project. name} inserts the project name
    • $ {Project. displayname} inserts the project displayname

For more details, go here.

How do I override those predefined variables?
    1. Go to tools | templates.
    2. Scroll to the end of the template manager and expand 'user configuration properties '.
    3. Select 'user. properties' and click 'open in editor '.
    4. Now you can add the above and set your own value, for example:
 
User = DonaldDuck@disney.com

Now, whenever you have $ {user} in a file template, you will find the above value generated into the file that you create using that template.

Note: The $ {date} variable is of Type string, not type date. you have to cast it to a date type then do the format. for example, to show the year only, do this:

 
$ {Date? Date? String ("YYYY ")}

Actually, the configuration is pretty good.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.