NetBeans 101 – Editor Options: Code Templates

This NetBeans 101 – Options – Editor (Code templates) video looks at the Code Templates in NetBeans. How To use them and How to create them. The code to recreate the Templates is also available below.

Advertisement


PHP Header Comment:

/*
* ------------------------------
* ${Comment_Heading}
* @author: ${user}
* ------------------------------${cursor}
*/

Advertisement


HTML Page Template:

<!doctype html>
<html lang='${LANG newVarName default="en-GB"}'>
  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>${TITLE newVarName default="Home Page"}</title>
    <meta name="description" content="${TITLE}">
    <meta name="keywords" content="${TITLE}">
    <meta name="author" content='${AUTHOR newVarName default="John Lavelle"}'>
    <link rel="stylesheet" type="text/css" href='${STYLE newVarName default="styles/style.css"}' media='screen'>
  </head>
  <body>
    ${cursor}@TODO write content
  </body>
</html>
<!--
${TITLE} ${COPYRIGHT newVarName default="Copyright ©2018 JLavelle.uk" editable=false} all rights reserved.
No part of this site may be reproduced without prior permission.
http://jlavelle.uk
-->

Advertisement


PHP MySQL Connection:

$$${CONLINK newVarName default="link"} = mysql_connect('localhost', 'mysql_user', 'mysql_password');  
if (!$$${CONLINK}) {
      die('Could not connect: ' . mysql_error());  
}  
echo 'Connected successfully';  
mysql_close($$${CONLINK});  
${cursor}

Advertisement