Skip Headers
Oracle® Universal Content Management
10g Release 4 (10.1.4)
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next

Adding, Editing, and Deleting Fragment Snippets

A snippet is the actual text or code that a fragment adds to a template. A fragment must have at least one snippet, which is defined by its insertion point (head of page, body, drop-point, and so on) in the template.

For example, if the fragment adds text to one place on the page, then you can create just one snippet for the fragment. But if the fragment inserts text or code in multiple locations on the page (such as a script that must be placed in the head and the body), then you must create two snippets for the fragment (one for the head and one for the body).

You can add, edit, and remove fragment snippets using the Fragment Editor.

To add or edit a snippet, perform these tasks:

  1. With the fragment open in the Fragment Editor, click Add to create a snippet, or highlight an existing snippet and click Properties.

    This opens the Snippet Properties dialog (see Snippet Properties Dialog).

  2. Enter a name for the snippet in the Name field. (The name may contain spaces and special characters, if you like.)

  3. Beside Location, choose an available option:

    • drop-point: Inserts the snippet where the cursor is located on the template.

    • head: Inserts the snippet in the head (specifically the end of the <HEAD> tag) of the page template.

    • top-of-body: Inserts the snippet at the beginning of the body (immediately following the <BODY> tag) in the page template.

    • bottom-of-body: Inserts the snippet at the end of the body (immediately preceding the </BODY> tag) in the page template.

  4. Beside Include, choose an available option:

    • simple: Adds the entire contents of the snippet to the template. If parameters are present, their values are added directly to the template, making them a permanent part of the page. The fragment, consequently, is no longer recognized as a fragment and its parameters cannot be modified (see Choosing Different Parameters for a Fragment).

    • inline: Adds the entire contents of the snippet to the template. As an inline snippet, however, the fragment and its parameters are still recognized as a fragment. You can still move the fragment, delete it, and modify its parameters.

    • reference: Adds a reference to the snippet in the template. As a referenced snippet, not only is it still recognized and managed as a fragment, but you can still edit the fragment in the Fragment Editor and immediately see your changes on the template (or templates if used more than once). This behavior is similar to that of an include file (HTML, CSS, script, and so on) on other Web sites.

  5. Beside Design View Code, enter the text you would like to appear as a placeholder for the fragment in the design view of a template. (This feature is intended for snippets that are inserted at the drop-point or the body of a page template and not the head.)

    To open the text editor, click the Additional Information icon (Figure), enter your text, and then click OK to close the text editor.

    Additional Information icon

    Additional Information icon
  6. Click OK to close the snippet properties and return to the Fragment Editor.

  7. With the snippet selected, you can add and edit the content of the snippet in the Snippet code text box.

    Snippet Code Text Box

    Snippet Code Text Box

Repeat these steps for every snippet that you would like to add or edit in this fragment. You can add as many snippets as you like.

To delete a snippet, simply highlight that snippet and click Delete.

Fragment snippets can be written in HTML, XML, JavaScript, Idoc Script, JavaServer Pages (JSP), and Active Server Pages (ASP). For ASP and JSP, however, you must place your code in a fragment asset (see Adding, Editing, and Deleting Fragment Assets) and then reference that code from an inline fragment snippet.

You should avoid the word "BODY" in an inline head snippet because that name conflicts with code already used by Site Studio to manage the head and body portions of a page template. If you must use this word in your snippet, then you should either (a) change the include method of the snippet from inline to reference, (b) put the code in a fragment asset (see Adding, Editing, and Deleting Fragment Assets), and then include it in your fragment that way, or (c) change the code so that the word "BODY" is split into two parts (two concatenated strings).

If you use the same fragment containing a referenced snippet on multiple Web sites on the content server, then any changes you make to that fragment immediately affect all Web sites where it is used. If this is not your intention, then you should create different fragments for each site (see Editing a Copy of a Fragment).


Note:

With ASP fragments, you can only include a snippet using the "simple" or "inline" method. Including by "reference" is not available because of the way ASP code handles includes.