Preparing MODX Templates for use with Fred
Fred only loads on Pages which use MODX Templates assigned to a Fred Theme (Extras
> Fred
> Themed Templates
). Any Resource using a template listed in that table will block access to the Content area in the Manager and load Fred on the front-end when logged in for editing.
Dropzones
Most templates will have a content Dropzone. Fred also supports multiple Dropzones for things like sidebars, headers, footers, or any other purpose you need. In your Fred Templates, you need to define where Dropzones will be by using data-fred-…
attributes with HTML.
Simple Fred Template Example with One Dropzone
The default minimum height for a dropzone is only 5 pixels, which may be a bit small to target. If you wish to have a larger “empty” default state, add a data-fred-min-height="250px"
setting with your desired minimum height. A larger minimum height on a dropzone can make it easier to target for dropping Elements when empty. The size of your min-height might also need to change if you have competing or overlapping Elements, such as a fixed top navigation bar.
The dropzone’s data-fred-dropzone="content"
attribute is required and tells it where to save the rendered Fred content. It also needs to contain a reference to the [[*content]]
tag inside of it. When Fred loads, it clears out the content rendered in the dropzone, and loads it with Element data. However, when Fred is not loaded, it just renders whatever tags you have in that area.
Multiple Dropzones
Sometimes you may want to have a more complex layout with multiple Dropzones, like for a main content area and a sidebar. Fred installs a new Template Variable type for this purpose: Fred Dropzone
. To create another dropzone do the following:
From the MODX Manager, navigate to the
Elements
sidebar tree >Template Variables
drop-down list >+
circle icon to create a new TVGive the TV a name, such as “sidebar” and assign it to a Fred category
From the
Input Options
tab choose "Fred Dropzone" from the Input Type select listIf you want to see the rendered content from the Manager, change the value of the last “Hide Field from Manager:” option to “No”.
From the
Template Access
tab and in theAccess
column, select the template(s) that will need access to the TV.Click the
Save
button when done.