Settings for Page Layouts and Display Types

Oct 31, 2014 3:59 pm

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:

<body class="[[setting.page_type]]">

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:

<if [[setting.page_type]] = "home">
<p>Show code for the home page.</p>
<else>
<p>Show other code.</p>
</if>

To create and setting, do the following:

  1. 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.
  2. Click "Add a new Setting".
  3. 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.
  4. Save the setting.
  5. Insert the setting tag to the page layout's code wherever you want to use it by clicking the "Insert a setting" button .
  6. Save the page layout.

To set the value of a setting on a display type:

  1. Create a display type based on the desired page layout.
  2. 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.
  3. Choose or enter the desired value of the setting.
  4. Save the display type.

Oct 31, 2014 4:01 pm

When Freedom renders a web page, setting tags are processed before embedded module layout and widget tags, which means you can actually use setting tags within layout tags. This provides a concise way to embed different module layouts and widgets based on a setting in the display type, provided the names of your module layouts and widgets correspond to the setting values.

For example, if you have a setting named "region" with the possible values of "charlotte" and "sarasota" and you have categories named "Charlotte" and "Sarasota" in your News module, you could create news lister layouts named "charlotte_news_lister" and "sarasota_news_lister" which each show only news articles in their respective category. Then, in the page layout you could use the following code to embed the desired news lister based on the setting value:

<h2>News for your region</h2>
[[layout.[[setting.region]]_news_lister]]