Scripts Pane
The Scripts pane contains all of the scripts that are used to replace data on your page, or to modify its look. Scripts can be exported and imported via the buttons or through drag & drop between the Scripts Pane and any location on the computer.
Scripts included here are completely distinct from the JavaScript resources
found in the Resources Pane. Think
of scripts as server-side in the sense that they are executed through
the Connect modules (Server and Content Creation especially). Scripts
have access to the whole PlanetPress Connect
JavaScript API (see JavaScript
in Designer), such as the Record. JavaScript resources, on the
other hand, are only executed in a client after
the content creation is done, which is generally in the browser.
Scripts are always executed top-to-bottom. They can be dragged higher
or lower in the pane to change their order of execution. For example,
content loading scripts (loading snippets, for instance) must be present
before scripts that replace data within that loaded contents.
The Scripts Pane has the following interaction buttons:
- Import...: Click to open a standard Open dialog to import a script. The script must have the .OL-script extension.
- Export...: Click to open a standard Save As dialog to save the currently selected scripts to disk. These scripts can be re-used in other templates. If more than one script is selected, they are all saved to a single file. If some scripts are inside folders, this folder structure is kept and will be restored when the scripts are imported.
- New: Displays a drop-down that shows the following options:
-
- Script: Adds a new empty basic script
- Text Script: The default script that is created when a Record Field is dragged on to the page.
- Dynamic Image Script: This script can be added and, providing it refers to an image by selector, can dynamically change the image for each record.
- Email To Script: This script is automatically added on any new Email template or Context and defines the email address where each record output is sent.
- Email Subject Script: This script can be added to Email contexts and defines the subject of the email that is sent.
- Conditional Content Script: This script can be added to conditionally show or hide any element in the template.
- Folder: Adds a folder in which scripts can be placed for easier management.
- Collapse All: Collapses all the folders, hiding the scripts inside of them.
In the contextual menu, the following options are also available:
- Duplicate: Click to create an exact copy of the script.
- Delete: Click to delete the selected script. This does not delete the element or text the script refers to.
- Rename: Click to open a rename dialog to rename the script. This is the same as changing the Name field in the script's properties.
- Enable/Disable: Click to trigger the script to be enabled or disabled. Disabled scripts are greyed out and italic and will not be executed.
Please see Script Generators for more
information on the different wizards that are available.
The Scripts Pane also shows each script as so:
- Name column: The friendly name added to better identify the script.
- Selector Column: Displays the initial text, or javascript selector, that the script applies to.
Fields from the Data Model Pane can be dragged directly into the Scripts
pane to create a Text Script. This is useful if, for instance, when
using snippets that already contain placeholders for text scripts.
Additionally, Text scripts can be dragged into any section to add
the script's placeholder at the insert location.