Download presentation
Presentation is loading. Please wait.
Published byEmil Ball Modified over 9 years ago
1
WDV 331 Dreamweaver Applications Snippets and Libraries Items Dreamweaver CS6 Chapter 18
2
Compare Snippets to Library Items Compared to snippets, Library items are much smarter. They possess the unique ability to update the same material on an entire site’s worth of files in seconds, and can successfully deal with links and images. Snippets are available for all sites you build. Unlike snippets, however, Dreamweaver’s Library feature is site-specific: Each site you set up in Dreamweaver has its own Library, and Dreamweaver stores that Library’s files along with all the site’s other files. You can’t use a Library item from one site when you’re working on a page from another site.
3
Snippets Basics Snippets aren’t fancy or complex, but they sure save time. A snippet is simply a chunk of code you store away and then plunk into your web pages as necessary. You keep these code chunks in the Snippets panel and summon them in a couple of ways: – Choose Window → Snippets. – Windows people can press Shift-F9. There’s no Mac keyboard shortcut for the Snippets panel, but you can create your own, using Keyboard Shortcuts
4
Using Snippets Snippets come in two varieties: – those that are simple blocks of code, – those that wrap around a currently selected element in a document. To add a snippet to a web page, click in the document where you want the item to go, or select the object you wish to wrap with a snippet. Do one of the following: – On the Snippets panel, double-click the name of the snippet. – On the Snippets panel, select the snippet, and then click the panel’s Insert button. – Drag the snippet from the panel into the document window. (If the snippet is supposed to wrap a selection, drag the snippet onto the selected object.)
5
Add a Snippet to a Web Page Click in the document where you want the item to go, or select the object you wish to wrap with a snippet. Then do one of the following: – On the Snippets panel, double-click the name of the snippet. – On the Snippets panel, select the snippet, and then click the panel’s Insert button. – Drag the snippet from the panel into the document window. If the snippet is supposed to wrap a selection, drag the snippet onto the selected object
6
Snippet info While you can use snippets in either Design or Code view, – some make sense only in Code view. For example, you typically have to insert the JavaScript snippets that come with Dreamweaver in the section of a page, inside tags. – To use these snippets, you have to switch to Code view, insert the tags, and then put the snippets inside. TIP To quickly insert a snippet you recently used, select the snippet’s name from Insert → Recent Snippets. – Better yet, create a keyboard shortcut for your favorite snippets, and then insert them with a keystroke, as described on Keyboard Shortcuts.
7
Snippet info Snippets simply dump their contents into a document — essentially copying the snippet code and pasting it into your web page; Dreamweaver doesn’t step in to make sure that you’re adding the code correctly.
8
Library Basics Imagine : You manage a large website consisting of thousands of pages. At the bottom of each one sits a simple copyright notice. Each time you add another page to your site, you could retype the copyright and apply format to it. The Library feature can turn anything you select in the document window (a paragraph, an image, a table) into a reusable chunk of HTML that you can easily drop into any Dreamweaver document. Keep in mind that Library items can contain only page elements that appear in the document window — in other words, only HTML from the section of a web page.
9
Library Basics You can’t include anything that appears in the of a page, like Cascading Style Sheets, Spry widgets,or meta tags. This means you can’t store Dreamweaver behaviors or Spry widgets in your Library, Library items must include a complete set of HTML tags — both an opening and a closing tag — as well as all the tags necessary to complete the original object. – For example, Dreamweaver doesn’t let you turn just a single cell, row, or column of a table into a Library item. If you try, Dreamweaver will add the entire table to the Library.
10
Creating and Using Library Items To create a Library item, start by opening the Library window. Click the Assets tab (to the right of the Files tab) or choose Window → Assets, and then click the Library items button
11
Add an Item to theLibrary Add the selection to the Library. Dreamweaver provides several ways to do this: – Drag the highlighted selection into the list of Library items. – Click the New Item button ( Figure 18-4 ). – Choose Modify → Library → Add Object to Library. The new item appears in the Assets panel, bearing the jaunty name “Untitled.” Type in a more useful name.
12
Add a Library Item to WebPage Add a Library item to a web page, drag it out of the Assets panel’s Library items list onto your page. The long way: – Click to plant your insertion point on the page, – click the Library item you want in the Assets panel, – in the Assets panel, click the Insert button. Assignment – Snippets & Library Tutorial – Book page 842 Kindle 18001
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.