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.
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. - For Web output, PNG is the preferred image format.
EPS, PDF, SVG and TIFF images in a Web section are automatically converted to PNG to ensure that they can be seen in the browser. Note that this conversion does not take place when you select a specific page from a PDF or TIFF using a URL (e.g. 'images/PDF_20pages.pdf?page=3').
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:
- Which Web section is the 'default'; see Setting a default Web page for output. When generating Web output, if there are multiple Web sections, only one of them can be merged with each record.
- The title, shortcut icon and meta tags appearing in the web page's header. See Setting the title, meta data and a shortcut icon
Attaching Web output to an Email template
To attach the Web context to Email output:
- Open a template with a Web context and an Email context.
- 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.
- Load a data file or database compatible with this template. See Loading data.
- 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.
- Fill in the dialog and send the emails.
Generating Web output from Workflow
Generating Web output from Workflow requires you to send a template with
a Web context to Workflow; see Sending files to Workflow.
Next, you will have to create a process in Workflow that serves one or more web pages; see Web processes with OL Connect tasks.
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.