One of the highly flexible portions of the SMS extension is the ability to create custom resources, select properties for the resources, and define how the resources will be shown in the Frontend. This is accomplished by defining a new Resource Type.
Caution: The rest of this section assumes the reader has an understanding of template records, TypoScript, cObjects, and how to use these in conjunction to provide Frontend output. For assistance with this, see the Support section of www.webempoweredchurch.com. WEC provides a self-help Community forum, and a list of third party providers who may assist you in your needs.
There area two steps to create and use a custom resource type for the SMS extension. Those steps are as follows:
Create a new SMS Resource Type record and TypoScript Object
Modify the SMS template file, inserting new markers as needed
Let's suppose your organization stores the Study Guides of each sermon in Adobe PDF files. You would like to make the file available for download, but would also like a preview of the document next to the document link. You would prefer the preview be generated from the first document page, rather than uploading a separate thumbnail image for every file. SMS Resource template markers alone will not accomplish this, but you can use the output from the TypoScript Object along with the ###RESOURCE_CONTENT### template marker to display this output.
Begin by logging into the TYPO3 Backend with an administration login. You must have administration privileges in order to modify template records.
Illustration 47: Adding a New Plugin Resource Type 1
Refer to Illustration 47. Click on the List Module in the Backend (1).
Click on the SMS Storage Folder (2).
Click on the Create New Record icon in the upper right corner of the screen (3).
Illustration 48: New Plugin Resource Type 2
Refer to Illustration 48. Scroll down and click on SMS Resource Types (4) to create a new resource type record.
Illustration 49: New Plugin Resource Type
Refer to Illustration 49. In the new SMS Resource Type record, fill in the Title, Marker Name, and TypoScript Object Fields, along with any other fields you require (5).
Note: The Template Name field, if left empty, will be assumed as TEMPLATE_{marker name} at run-time. In this example, the template name would be assumed as TEMPLATE_SERMON_GUIDE
Refer to Illustration 50. Scroll down the page to t
Illustration 50: Add File Field to Resource Type
he Visible Resource Fields. Click the File item to add the file field to this resource type (6). This allows you to upload a file directly into this Sermon Guide resource type.
Click the Save & Close button (7).
After creating the SMS Resource Type records, you need to modify the existing template file and add markers for the new SMS Resource Type.
Tip: See the Modifying the Layout Template portion of this document, under the Advanced Options section, for details on making a copy of the existing template file for modification.
Illustration 51: Edit the Template Resource
Refer to Illustration 51. Click on the Template module. (1)
Click the page name Sermon, (or other location where the template record for SMS is stored.) (2)
Choose Info/Modify from the drop down menu in the upper right of the screen. (3)
Click the Edit pencil image, to the left of Resources: which opens another edit page. (4)
Illustration 52: Edit the SMS Template Resource
Refer to Illustration 52. Click on the Edit pencil image on the wecsermons.tmpl record of the UPDATE RESOURCE LIST (5).
Illustration 53: Edit the Template, Insert the Sermon Guide Marker
Refer to Illustration 53. Find the template you wish to modify and insert the Sermon Guide marker: <!--###SERMON_GUIDE###--> ###RESOURCE_CONTENT###<!--###SERMON_GUIDE###--> (6)The template marker, ###SERMON_GUIDE### sets the start and end point where the output for a sermon guide will be placed in the template. The marker ###RESOURCE_CONTENT### tells the SMS to show the Sermon Guide using the TypoScript object.
Illustration 54: Insert the Sermon Subpart Marker
Refer to Illustration 54. Insert a subpart marker for the Sermon Guide template (7). The Sermon Guide template is used to display the single view of a Sermon Guide Resource.
Refer to Illustration 53 again. Click the Update button to save your changes to the template file.
In some circumstances you may not get all that you need out of a new resource type, using template markers alone. This is the point that TypoScript takes over, giving you advanced control of how your custom resource type is shown.
Illustration 55: TypoScript Object Name Field in an SMS Resource Type Record
Technical Stuff: For every resource type, there is a ###RESOURCE_CONTENT### marker that renders TypoScript content objects (cObjects). Within the setup field of a template record, you can use TypoScript to configure this advanced output of your custom resources. This is accomplished by adding new properties to the resource_type cObject array.
The resource_type cOjbect:
plugin.tx_wecsermons_pi1.resource_types = CASE
The resource_types object is a CASE content object (cOjbect). This object contains an array that defines how to display each resource type on the Frontend. Each array property name is defined by the TypoScript Object Name field of the SMS Resource Type record (see Illustration 55).
Example TypoScript Code
plugin.tx_wecsermons_pi1.resource_types {
# PDF (Portable Document)
pdf = COA
pdf {
...
}
# Flash video
flv = COA
flv {
...
}
# MP3 Audio
mp3 = COA
mp3 {
...
}
# Sermon Guide
sermonguide = COA
sermonguide {
...
}
# Other custom resources
...
}
Text 1: TypoScript Example for Custom Resources
To create a new TypoScript Object, begin by logging into the TYPO3 Backend with an administration login.
Refer to Illustration 56
Illustration 56: Adding TypoScript for a New Resource 1
. Click on the Template Module (1).
Click on the page where the SMS Static Template is installed on your site—typically either the Root Page (Home) or the Sermons page (2).
Click the upper right dropdown, and select Info/Modify (3).
Click the Edit icon (pencil) to the right of Setup (4).
Refer to Illustration 57
Illustration 57: Adding TypoScript for a New Resource
. Insert your new TypoScript code (5) to update the resource_types object array, creating a new definition for SermonGuide. (See Text 1 below for example code.)
Click the Update button to save your changes (6).
Example TypoScript Code
plugin.tx_wecsermons_pi1.resource_types {
# Sermon Guide (PDF format)
# Use COA, content object array, to output multiple types of content at once
SermonGuide = COA
SermonGuide {# Use the image cObject to output a preview of the PDF file
10 = IMAGE
10 {prefixComment = 2 | Sermon Guide Preview:
altText.field = title
file.import = uploads/tx_wecsermons/
file.import.field = file
file.width = 150m
file.height = 150m
wrap = <div class="tx-wecsermons-pi1-sermonguide-preview" style="float: left;">|</div>
stdWrap.typolink {
parameter = uploads/tx_wecsermons/{field:file} parameter {setCurrent.field = file
setCurrent.listNum = 0
insertData = 1
}
}
}
# Use the text cObject to output the title of this resource, wrapping the title
# in a link to the file attachment
20 = TEXT
20.prefixComment = 2 | Sermon Guide File Link:
20.field = title
20.typolink { parameter = uploads/tx_wecsermons/{field:file}parameter.insertData = 1
}
20.wrap = <p class="bodytext">|</p>
30 = TEXT
30.field = description
30.parseFunc < plugin.tx_wecsermons_pi1.general_stdWrap.parseFunc
wrap = <div class="tx-wecsermons-pi1-sermonguide">|</div>
}
}
Text 1: Example TypoScript Code for Illustration 49
Above is the example code needed for Illustration 55. This is obviously a complicated example, so take a look at the Simplified TypoScript Example section below for more detail.