Expanding the TCF

Now that two TCFs have been created, it is time to extend some additional functionality. This portion of the tutorial will review just a few of the ways that the TCF, and then ultimately the TMPL can be expanded. Refer to the Support site for more information on available options and attributes.

This section will focus on:

  • Adding a mini-WYSIWYG Editor to the available options
  • Overriding access settings using <template> attributes

Adding a Mini-WYSIWYG Editor to New Page Creation

Currently, the meta description is being passed to the TMPL, and ultimately to the PCF as starter content for the page. It is possible to make this starter content more complete and allow for a more detailed starter page. To do this, a new variable is added to the TCF with the editor attribute included. The echo variable in the TMPL for the content region that is currently using “description” is then updated with the new variable.

For this demonstration, the updates will be made in the newly created common variables file, making them available on all TCF using that include. Keep in mind that this example is using the same TMPL for all files currently using the common variables include file, but if there were different page templates, they would need to all be updated with the new variable name to pass this content.

  1. Navigate to /_resources/ou/templates
  2. Open and edit in source in
  3. After the page type variable, add a new variable for page content. Since the WYSIWYG Editor will be used (editor="yes"), the output will have HTML tags included. Make sure to include output="xml" to properly pass the encoding.

    <variable name="pagecontent" type="text" editor="yes" rows="10" prompt="Body Content:" alt="Add some starter content to your page." Output="xml"></variable>
  4. Save the changes. 
  5. In the TMPL (pt-new-page.tmpl), change the echo variable for the content to look for “pagecontent.” Again, since HTML tags will be included, be sure to add encoding="none" to the echo variable. Remove the <p> tags that were in place for the description being passed.

    <!-- ouc:div label="maincontent" group="Everyone" button="700" --><!-- ouc:editor csspath="/_resources/ou/editor/pt-onecolumn.css" cssmenu="/_resources/ou/editor/pt-styles.txt" width="1042"/ --><!--%echo var="pagecontent" encoding="none" --><!-- /ouc:div -->
  6. Save the changes. 
  7. Test the updates by creating a new section using the template created earlier.
    Note: Since the new page TCF created earlier was not updated to use the common variables include, that template will not yet reflect these changes.

New Section


Overriding Access Settings

Now that the TCF was updated with a new variable, the <template> node can be updated to override some access settings that may be defined by the directory. This allows an administrator to define permissions based on the file and not necessarily where it appears in the site. This can also be used in a <directory> node to override access settings for a directory that is being created. Some good examples of how this may be used include:

  • Excluding include files, such as side navigation, from being included in the sitemap generated in Setup > Sites.
  • Overriding access settings on property files to restrict them to administrators only.
  • Setting a publishers group for files that should be automatically published.
  • Setting a template group for a binary folder that will be created.

Pros and Cons of Auto-Publish

At this point, it is valuable to take a moment to understand the pros and cons of auto-publish on page creation. There are many things to consider, but the main areas are:

  • Will users have approvers assigned?
  • How long is it generally between page creation and publish?
  • Will the publishers remember to publish both the new page and the updated or new include files?

If a user has an approver assigned, or there is an approver assigned to the directory where the new files are being created, an error will be encountered on page creation when using auto-publish. The user then needs to dismiss the error, cancel the page creation, and refresh to see if any or all of the files were actually created. Depending on the TCF configuration and the number of files that are being created, it is possible that all necessary files will not be created.

For instance:

  • The user is creating a new section template, which includes an index page, side navigation, and breadcrumb file, in that order.
  • The side navigation and the breadcrumb file are both set to auto-publish.
  • The user has an approver.
  • When the user attempts to create the new section, the auto-publish will “choke” on the side navigation resulting in the breadcrumb file never being created, which will cause an error on the page.

This can be avoided by not auto-publishing the files, which means that the publisher will need to remember to publish them when the page initially gets published. Alternatively, the user can be placed in a publishers group that gets assigned to those files via the TCF. The user can then publish just those files, allowing the auto-publish to complete on page creation. If the auto-publish is set on new page creation and not just new sections, then in this case a broken link will exist on the production server until the new page is published as the side navigation will appear on other pages in the section and have a link to a page that does not yet exist.

As a best practice, do not auto-publish files as having pages on production that link to non-existent pages is not preferred. Keep in mind, however, that this requires publishing more than one file when the page is initially ready to be published. Be sure all users are properly trained on the needs of the templates.

Setting Overrides

In this example, the settings to be overridden are:

  • Defining a folder only template group for the pdfs directory.
  • Excluding both the properties file and side navigation file from being indexed by the sitemap.
  • Defining the access group for the properties file as “None.”

These changes will be made in this example in the new section template created earlier.

  1. Navigate to /_resources/ou/templates.
  2. Open and edit in source the pt-new-section.tcf.
  3. In the <directory> node for creating a new pdfs folder, add: template-group="Folder Only"

    <parent path="{directory/}">
    <directory name="new-dir">{dirname}</directory>
    <directory name="new-images" template-group="Folder Only">{dirname}/pdfs</directory>
  4. Save the changes. 
  5. Navigate to the file and edit with the source editor.
  6. In the first <template> node for the navigation, add: exclude-sitemap="yes"
  7. In the second <template> node for the properties, add: exclude-sitemap="yes" and group="None"

    <template prompt-prefix="Navigation" filename="_leftnav" extension="inc" display-filename="no" destination="{new-dir}" force-destination="yes" display-group="no" display-destination="no" display-overwrite="no" preferred-redirect="no" publish="no" exclude-sitemap="yes">leftnav.tmpl</template>
    <template prompt-prefix="Properties" filename="_properties" extension="inc" display-filename="no" destination="{new-dir}" force-destination="yes" display-group="no" display-destination="no" display-overwrite="no" preferred-redirect="no" publish="no" exclude-sitemap="yes"group="None">properties.tmpl</template>

  8. Save the changes. 
  9. Test by creating a new section and verify that the settings were passed. 

Verifying Settings

Index Access Settings

The access settings were all inherited from parent directory. 

Access Settings

LeftNav Access Settings

The access settings were all inherited from parent directory, except the Exclude From Sitemap

Access Settings

Properties Access Settings

The access settings were all inherited from parent directory, except the Access Group and Exclude From Sitemap.

Access Settings

PDFs Access Settings

The access settings were all inherited from parent directory, except the Template Group.

Access Settings

Was this page helpful?

Additional Comments:

(Include your email address if you would like a reply)