Generating Web output

The Web context outputs one HTML web page. In addition to the HTML text it contains either the resources or references to the resources necessary to display it.
JavaScript files are added to the <head> in the generated HTML file. JavaScript toolboxes like jQuery and its plugins, or MooTools, are useful when you want to implement special features in the web page. (See Using JavaScript.)
Style sheets are also added to the <head> and are used just as they would be used in a regular web page. (Also see: Styling templates with CSS files.)

Web output can be generated in two different ways: it can be attached to an Email template when generating Email output, or it can be generated using Workflow.

Web output can be generated from the Designer when a data set is available. The data can be retrieved from a database or data file, or from a data mapping configuration.

If you have an open data mapping configuration and open another data file, the current data mapping configuration will try to retrieve data from the file or database using its own Data Model and extraction logic.

When generating output with just an open data mapping configuration, the template is merged with the complete sample data file that is part of the data mapping configuration. The output is not limited to the number of records shown in the Data Model pane (which is one of the settings in the DataMapper).
Before generating Web output

Before actually generating the Web output, you may want to rasterize certain elements, such as business graphics. Rasterizing converts the element to a JPG or PNG image. This is very useful to support as many clients as possible. For example, when a heading uses a font type that is not a Web font, converting the heading to JPG instead would ensure that the heading looks the same in all browsers.
To rasterize an element, right-click it and select Rasterize options. For a JPG image you can set the quality of the resulting image in a percentage.

Rasterization options are only available for Boxes (<div> elements); see Boxes.

Web output settings in the Web context and sections

There are a few settings for the Web context and Web sections that have an impact on the actual web page that is generated.

These settings are:

Attaching Web output to an Email template

To attach the Web context to Email output:

  1. Open a template with a Web context and an Email context.
  2. Check the output settings for both contexts; see Email output settings in the Email context and sections and Web output settings in the Web context and sections.
    When adding the Web context to an email, only the default Web section is generated and added to the email as an HTML file. To attach multiple Web sections as separate attachments, you need to create a Control Script that specifies parts; see Control Scripts and Control Script API.
  3. Load a data file or database compatible with this template. See Loading data.
  4. On the File menu, click Send Email or Send Test Email. In the dialog that appears, check the option to attach the Web context to the email. See Send (Test) Email for a description of all options.

    When you send a test email, the Email To Script will not be used; instead, the email will be sent to the address that you specify in the Send Test Email dialog.

  5. Fill in the dialog and send the emails.

Generating Web output from Workflow

  1. Open a template with a Web context.
  2. Send it to Workflow using the Package Files dialog; see Sending files to Workflow.
  3. Create a process in Workflow containing at least the following steps:
    • Any input that will capture a job file that is compatible with the data mapping configuration that is used. To capture incoming web requests, such as from a personalized URL (see Personalized URL), use a HTTP Server Input task (see Workflow Help: HTTP Server Input).
    • An Execute Data Mapping task to generate a valid record set (see Workflow Help: Execute DataMapping Task).
    • A Create Web Content task with the appropriate settings, to generate the HTML output (see Workflow Help: Create Web Content).
Athough Workflow can serve both static and dynamic resources to a web browser, it is not meant to be used as a fully featured web server as it is not built for responsiveness nor guaranteed uptime. It is recommended to use a common web server (for example, IIS or Apache) to serve your contents and to let Workflow process things only it can do.
For more information on how to serve HTML and PDF generated by Connect through IIS, watch the Connect with Evie - IIS series.

Aborting content creation

You may want the content creation process to be aborted in certain situations; for example, when a template script fails to load remote content. To abort the content creation process, you may raise a fatal error from within a script in the template; see fatalError(message).

When a script calls this function in Preview mode, the script that triggers it is marked with an error icon in the Scripts pane, and the given message is displayed in a hint.

When generating output from the Designer, the Designer will log the error and display an error dialog with the given message. Content creation is aborted.

When generating output from Workflow, the entire job fails. Workflow will log the error and execute any follow-up actions that are defined in the On Error tab of the respective OL Connect Content Creation task (All in One, Create Email Content, Create Print Content, Create Preview PDF, and Create Web Content ). For more information about how to set up follow-up actions, see Using the On Error tab in the Workflow Help.