All Collections
CMS
Content Management
Managing your content with modules part II
Managing your content with modules part II
Add modules to pages using short codes.
Matthew Garrepy avatar
Written by Matthew Garrepy
Updated over a week ago

Overview

The article titled Managing your content with modules showed users how to create and modify blog modules and their entries. This article shows the user how to add blog modules to a page. 

Solodev recommends using short codes to add Modules to pages. This document will use the blog from the previous example. Before adding the Blog Module to a page, the user must create a repeater and detail files. 

Step 1 – Creating a repeater template

The repeater template, although optional, displays all entries in the module used. The repeater is written in Solodev Short codes and refers to the user interface template, printing fields in the form of PHP variables through an $item array.

Shortcode

[repeater]


Attributes:

  • Open the desired folder that will contain the repeater file. 

  • Click Add File and enter the Name, Title, and Description

  • Select Code for the File Type.

  • Click Submit.

  • In the file enter the following code: 

[repeater id="##" limit="0,2"]

<h2>{{event_title}}</h2>

<p>{{blog_intro}}</p>

<a href="{{path}}">{{event_title}}</a>

[/repeater]
  • Click Publish

Step 2 – Creating a detail template

The display template shows the specifics of an individual entry from a repeater template. An example would be clicking on an individual blog entry from a list of entries to see the entire blog post. The detail page is a subpage of its parent page on the repeater template. 

Shortcode:

[entry]
  • Open the desired folder that will contain the detail file. 

  • Click Add File and enter the Name, Title, and Description

  • Select Code for the File Type.

  • Click Submit.

  • In the file enter the code: 

[entry]

<h1>{{name}}</h1>

<p>{{blog_content}}</p>

[/entry]
  • Click Publish.

Step 3 – Create a page to house the repeater template

  • Expand the www folder and open the folder that will contain the repeater page. 

  • Click Add Page

  • In the Add Page modal and enter the Name, Title, and Description for the page. 

  • Click Submit.

  • Open the page and click the dropzone that will contain the repeater template file. 

  • Select the repeater template to insert into the dropzone.

 

  • Click Publish.

Step 4 – Create a page to house the detail template

  • Expand the www folder and open the folder that will contain the detail page. 

  • Click Add Page

  • In the Add Page modal and enter the Name, Title, and Description for the page. 

  • Click Submit.

  • Open the page and click the dropzone that will contain the detail template file. 

  • Select the detail template to insert into the dropzone. 

  • Click Publish

Step 5 – Linking the repeater page to the detail page

  • Open the Blog Module located in the web files -> managers -> Blog Module folder.

  • Click Modify

  • In the Modify Blog modal click the arrow located to the right of Website Properties

  • Click Browse in the Detail Page Template section. 

  • Select the .stml page that contains the detail template. 

  • Click Choose.

  • Click Browse in the Detail Folder Location

  • Click Choose to select the folder that contains the news detail page. 

  • Click Submit

Note: Solodev recommends creating the detail and repeater templates and pages before adding entries to the blog. If the user had added entries before doing so, the user must open and save each entry for the linking process to take effect. 

Did this answer your question?