Settings for Page Layouts and Display Types
Beginning in Freedom version 8.7, page layouts can include settings, which are essentially variables that can be set on any display type which uses that page layout. The settings must be created on a page layout, but their values are set on the display types that use the page layout. You can set different values for the same setting on each display type. Setting tags, of the format [[setting.setting_name]], can be included in the page layout's code to display their values, or they can be used within <if> tags as conditions to determine what is rendered when the webpage is loaded. Using settings can greatly reduce the number of page layouts you have to manage and help eliminate having the same code segments in multiple page layouts.
For example, if you want to put a different class on the body element depending on the display type used, you could use the following code:
On each display type using that page layout you could then enter a unique value for the page_type setting.
You can also use settings to alter what code is displayed by using setting tags as <if> conditions:
<p>Show code for the home page.</p>
<p>Show other code.</p>
To create and setting, do the following:
- To create settings on a page layout, click the "Toggle Settings Editor" button in the text area's toolbar to display the settings area below the text area.
- Click "Add a new Setting".
- Give the setting a name and label, and choose the type.
- "Text" will create a text box on the display type and use its value when rendering the page layout.
- "Select List" will create a dropdown list containing the options you specify here.
- "Checkboxes" will create one or more checkboxes, each with the value you specify here.
- "Radio Buttons" will create a group of radio buttons, each with the value you specify here.
- "Upload Image" will allow you to upload an image whose source URL will be inserted at the position of the setting tag.
- "Link" will open the Link Wizard allowing you to enter a URL.
- "Container" will allow you to choose one or more widgets or module layouts on the display type to be embedded in the page layout.
- Save the setting.
- Insert the setting tag to the page layout's code wherever you want to use it by clicking the "Insert a setting" button .
- Save the page layout.
To set the value of a setting on a display type:
- Create a display type based on the desired page layout.
- You will see a list of all the settings contained on the page layout, and, in the case of Select, Checkboxes, Radio Buttons or Containers, the setting's predefined options.
- Choose or enter the desired value of the setting.
- Save the display type.