Skip to content

Using Templates

A content block in Template mode with some template configuration options
A content block in Template mode with some template configuration options

If you choose to populate a container with a Template as its contents, the template configuration options appear. What options are available may change depending on what you select each step of the way.

The first step is choosing how the template’s contents are hydrated.

1. Entering template contents directly

A template's contents being edited directly
A template’s contents being edited directly

If you choose “Enter Information Directly”, Phosis will display text boxes for each of the objects the selected template contains and any parameters/attributes of those objects that the frontend developer defined as being data-driven.

You have several options here:

  • You can directly enter text/information for each item like filling out a form. When Phosis hydrates this template, it will simply place your entries into the object’s text/attributes and render them out.
  • If you’ve defined any “Settings” objects via Custom Data, you’ll have a dropdown menu and you can choose from one of your settings objects.
  • Or, you can click Open Files to browse to a file within Phosis. The value returned will be the file’s permanent URL, so this should be used for src and similar attributes.

2. Hydrating with a data source

Choosing a data source for your template hydration
Choosing a data source for your template hydration

On the other hand, you can select “Use a Data Source” which will give you a dropdown of all the data sources in your site along with configuration options.

Phosis will then duplicate the template’s code for each entry and hydrate it based on mapping that you’ll configure below.

In other words, if you use the Articles data source and specify a quantity of 3 articles, Phosis will make 3 copies of your template and loop through your 3 articles, filling each template with the information based on your mapping.

Phosis has some built-in data sources, and if you’ve set up any Custom Data you’ll see those in this dropdown menu as well:

a. Self

The Self data source is the current page you’re on or, if you’re configuring this content block on an article style, the article that’s being displayed.

When you select this data source, the maximum amount of copies of your template Phosis will make is 1.

b. Built-In Pages/Articles

The Pages and Articles data sources are your site’s corpus of pages and articles, respectively.

When you select this data source, the maximum amount of copies of your template Phosis makes depends on your options/filters and the number of items you choose to retrieve.

You’ll recall that back in The User Interface’s Parent & Child Content section we said,

When articles or article styles are nested underneath a page and that top-level page is set up to display articles, Phosis will automatically “scope” what it loads to that page’s children only – automatically allowing you to easily set up something like a category or section homepage without having to worry about tags and taxonomy.

We can demonstrate what this means if you create a top-level page in Phosis, create an article style underneath it, and then create articles underneath & using that article style:

An example of the structure we're talking about in the site tree
An example of the structure we’re talking about in the site tree

Using the Articles data source on the Test Articles page automatically scopes the articles it loads to only its child content — in this case, the two articles. You can see this in action here: http://phosistest.mattermindworks.com/articles, which (as of this writing) looks like this:

Displaying only child articles underneath a parent page, ordered by date descending
Displaying only child articles underneath a parent page, ordered by date descending

Going more than one “category” deep is presently untested as of v0.76, but may be possible in future versions.

c. Custom Data

This option lets you leverage any Custom Data tables you’ve set up so you can reuse content across any page on your site while being able to edit it in a single location.

An upcoming update to Phosis will also be adding the custom Form content typev0.8 and external JSON data sources.v0.9

3. Data source mapping and options & filters

If you select Pages/Articles or Custom Data, the mapping and options & filters sections appear:

Data Source mapping & options
Data Source mapping & options

a. Data field mapping

Each Phosis object & any of their additional attributes marked as items of interest in your template will have a row here.

Use the dropdown in the Mapping column to tell Phosis what field from each data source entry should be used as this object’s content.

In other words, you may have a “Hero Image” object set up to accept a data-bound src attribute value. If you’re using the Articles data source, you’d probably choose the Hero Image Url field for mapping this.

b. Options & filters

As of v0.76, you can currently tell Phosis how many of your data source’s entries to display1 and how to sort them. Future versions will add additional, more powerful filtering options!


  1. Remember, Phosis will create a copy of your template for every entry and then hydrate it based on the mappings you set up.