Login / Status
developer.Resource
Home . Documentation . Document Library . Extension Manuals
Sponsors
hosted by punkt.deTYPO3 and Open Source MagazineAOE Media

10.6. Modifying a Default Template File

The Calendar Base extension provides nearly fifty different templates, any or all of which are fully customizable to suit your needs. The following instructions will walk you through the process for editing any of the templates.

Caution: Modifying a Calendar Base template is not a task for the uninitiated. A knowledge of basic HTML and CSS are essential to make successful modifications. Poor coding can render the template unusable.

Modifying the template is a three step process:

  1. Download a Calendar Base template file

  2. Modify the template file

  3. Upload and activate the modified template file

Step 1: Download a Calendar Base Template

Illustration 48: Downloading the Template

The Calendar Base template files are tucked away in the deep recesses of TYPO3. To download a Calendar Base template:

  1. Refer to Illustration 48. Open the Ext Manager Module (1).

  2. Click the Loaded Extensions option under the Menu: drop down box (2).

  3. Scroll down the list of extensions and click on the WEC Calendar Base link (3).

  1. Illustration 49: Downloading the Template

    Refer to Illustration 49. Select Edit files from the dropdown list (4).

  1. Refer to Illustration 50. Next, scroll down the file list and and click on the template file name you want to edit (5).

  2. Illustration 50: Selecting a Template for Modification

    Save the file onto your local computer. You may change the name of the file if you'd like; however, the extension .tmpl should not be changed.

Note: If your browser gives you the option to Open or Save the template file, choose to Save the file. Opening the file will result in a loss of significant information.

Step 2: Edit the Template File

On

Illustration 51: Typical Template with Subpart Markers and Markers

ce you've downloaded and saved the template file on your local computer, it is simply a matter of opening the file in your favorite HTML editor (MS Notepad, Write, Dreamweaver, etc.) and modifying the file. See Illustration 51 for an example of a typical template.

Technical Stuff: How the Template Works. As you view the template in your HTML editor, you will see what looks like a “nearly” standard HTML file. The file is wrapped in <html>, <head>, and <body> tags like most web pages. However, the template uses markers to direct TYPO3 to reference and render only relevant portions of the Calendar Base records. Each marker is itself wrapped in triple hash marks such as ###PAGES###. Each of the markers are defined at the top of the template itself for your convenience (release 1.0).

Modifying the template is a matter of combining standard HTML tags with the Calendar Base Markers. In general, the HTML tags dictate the format and layout of your Frontend display, while the Markers dictate what information is displayed. However, the importance of Subpart Markers cannot be overstated. Subpart Markers denote particular subsections of the layout. Subpart Markers are encapsulating markers, that is, they work like opening and closing tags. However, note that the formatting is unlike HTML tags; instead, they simply repeat themselves at the beginning and end of a section and look a bit like a pair of HTML comments:

<!-- ###SUBPART_MARKER### -->

Your <HTML TAGS> and

###CalBase_Markers###

are nested between Subpart Markers

<!-- ###SUBPART_MARKER### -->

In addition, the Calendar Base Subpart Markers are appended with Begin and End comments within the Subpart Markers for clarification:

<!-- ###SUBPART_MARKER### begin -->

Note: Although the convention is to capitalize the name of the Markers, they are not case sensitive.

Most of the modifications of the template itself are self-evident, assuming you have some HTML formatting experience. By looking at the existing template file, you should be able to discern the general syntax of the template itself.

Once you have finished editing the Template file, save it. You may rename the file for your own reference if desired, but the extension .tmpl should not be changed.

Step 3: Activate the Modified Template File

Once you've successfully modified the template file, upload and activate the file by:

  1. Refer to Illustration 52.

    Illustration 52: Choosing Your Upload Location

    Click the Filelist Module (1), select the folder where you wish to upload your file to, (2) and click the Upload Files button (3).

  1. Follow the directions and upload the file into the ext-templates sub-directory. Your modified template should now be uploaded to the location you chose. In our example here, the path to that location is: fileadmin/ext-templates/TemplateName.tmpl

  1. Illustration 53: Pointing TYPO3 to the Modified Template File

    Refer to Illustration 53. Click the Template module (4), and click the page where your Calendar Base plugin is configured (5).

  2. Choose the Constant Editor from the drop down list in the upper right corner of the page (6), and chose Calendar Base (Templates) from the Category: drop down list (7).

  3. Scroll down the page to find the template you've modified and put a check in the corresponding check box (8).

  4. Scroll back up and click Update (9) to enable the text input box.

  5. In the text input box,  insert the path of your modified template (in our example, it would be fileadmin/ext-templates/YourTemplateName.tmpl). Scroll back up and click the Update button once again.

Do the same for any or all the templates you wish to modify.