|
Web pagesWeb pages (also called Web sections) are part of the Web context (see Web Context) in a template. The Web context outputs one HTML web page that contains the HTML text and all the resources necessary to display it. JavaScript files are added to the <head> in the generated HTML file. They are useful to add special features such as those offered by jQuery and its plugins, or MooTools. Style sheets are also added to the <head> and are used just as they would be used in a regular web page. A Web context can contain multiple templates. When generating output from the Web context, however, only one of the Web templates can be merged with each record. Set the 'default' Web section (see Setting a default Web page for output) before generating Web output; also see Generating Web output. Creating a Web pageWhen creating a Web page, it is advisable to follow design guidelines for web pages, so that they are likely to look good in different browsers and on different devices and screen sizes. When you start with a Web Template Wizard, the Foundation framework is added to the template, to guarantee just that; see Creating a Web template with a Wizard. Other approaches are described below, in Adding a Web page. Adding a Web pageWhen a Web template is created (see Creating a Web template with a Wizard), only one Web section is added to it. A Web context may contain various templates, but per record only one of those can be used to generate output. It is not possible to add a Web section to an existing Web context with the help of a Template Wizard. To provide alternative content for the web page, you could use Conditional Content (see Showing content conditionally), or Snippets and a script (see the Help topics Snippets and Loading a snippet via a script, and this how-to: Multi-page Web template.) For an example of how to serve different web pages using snippets, see the following how-to: Creating a multi-page Web template.
If you would like to start with a template that is identical to the one you already have, consider copying it (see Copying a section). To add a blank section to the Web context:
Deleting a Web pageTo delete a Web section:
No backup files are maintained in the template. The only way to recover a deleted section, is to click Undo on the Edit menu, until the deleted section is restored. After closing and reopening the template it is no longer possible to restore the deleted context this way. Filling a Web pageMany of the content elements that are available for all three contexts are particularly suitable for web pages; see Content elements. Do not use Positioned Boxes and Tables to position elements, however; use Inline Boxes instead. Forms and Form elements are only available in a Web context; see Forms and Form Elements. Using variable data on a Web pageWeb templates are personalized just like any other template; see Variable Data. There are a few extra possibilities, though: variable data can be used in Form elements and they can be passed to client-side JavaScript. Using Variable Data in Form elementsVariable data may be used in form elements, such as a drop-down list (a Select element). How to do that, is described in this how-to: Dynamically add options to a dropdown. Passing Variable Data to client-side JavaScriptWhen serving Web pages using Workflow, the HTML is first personalized and then served to the web browser by a Workflow process. At that stage custom JavaScripts do not have access to the information stored in the Data Model. To enable a client-side script to use variable data, you need to create a Text Script that produces a JSON string and stores that in the attribute of an HTML element, the Styling and formatting a Web pageThe contents of a Web section can be formatted directly, or styled with Cascading Style Sheets (CSS). See Styling and formatting. In order for a style sheet to be applied to a specific section, it needs to be included in that section. There are two ways to do this. Drag & drop a style sheet
Using the Includes dialog
Setting a default Web page for outputWhen generating output from the Web context, only one of the Web templates can be merged with each record. To select the Web section that will be output by default:
Use a Control Script to dynamically select a Web section for output depending on the value of a data field. See Control Scripts. Including JavaScript filesWhich JavaScript files are included in the a Web section, depends on a setting for that section. To change this:
For more information about using JavaScript files, see Using JavaScript. Setting the title, meta data and a shortcut iconEach Web section has a set of properties to define the title of the web page, the shortcut icon and the meta tags appearing in the web page's head (with the HTML tag: <head>, see http://www.w3schools.com/tags/tag_head.asp). To change these properties:
Adding information to the <head> via scriptWhen generating Web output, the Designer automatically adds the included resources to the <head>. To add other tags to the <head>, such as a <base> tag to set a default base URL/target for all relative URLs in a document, you need to write a script. If you are not familiar with scripts, see Writing your own scripts for an explanation of how scripts work.
ExampleThe following script adds a <base> element to the head of a web page.
|
|