Using Code Snippets
Often we developers have to write the same code over and over again for each new site we create. We generally have a base of code that we start off with or items we use regularly. Some of us may be organized enough to maintain templates or code libraries with snippets of items we use most often. Code snippets let you store content for quick reuse. I often grab bits from other sites I have created so I have to type less.
Today I discovered a fabulous feature in Dreamweaver. Dreamweaver contains some predefined snippets that you can use as a starting point and lets you build and save your own. You can create and insert snippets of HTML, JavaScript, CFML, ASP, JSP, and more. The standard ones are organized by their functions, like navigation, or Headers and Footers. The only problem I have with the standard issued snippets is that they are largely table based. So I set about creating my own CSS based snippets and stored them in their own folder. Below is a short list of snippets I created and will reuse.
Header - with logo and menu navigation
Basic Menu list items (home, products, services, about us, contact, etc…)
Standard Contact forms - simple email and comments to full name address and phone forms.
Footer - with copyright and designed by link.
2-Column div structure with Header and Footer divs
3-Column div structure with Header and Footer divs
A paragraph of “lorem ipsum”
Subscribe form - for newsletters.
I will likely add some CSS code snippets to for box elements I tend to use over and over, or Menu structures. Overall I think this will be a very useful feature and help me develop sites more quickly. Snippets are available in Dreamweaver 8 and MX. You can create your own text library of snippets if you are a hand coder.