|
Synopsis
The Discus Template Language is used within skins and for generating interfaces from ordinary templates. This page documents the methods that skins or templates can communicate with the currently chosen skin. This page has the common commands ordered from most commonly used to least frequently used.
Inserting part of a skin at present location
<#insert part () "topics"#>
<#insert part ($head->{topic_number}) "dynamic_top"#>
There are two methods with which a part of a skin can be inserted into the template that is presently being rendered. You can call part of the currently chosen skin, or part of the custom skin for the topic, using the syntax above.
The parentheses () are required. If there is nothing between the parentheses (as in the first line, or as would be the case in the second line of $head->{topic_number} is not defined), the program will extract the part of the global skin (the one selected through Appearance Manager).
If a topic number is provided within the parentheses, either hard-coded or via variable substitution, the program will extract the part of the customized skin for the topic given. If a customized skin for that topic does not exist, the program will use the global skin, just as if no topic number had been supplied.
Testing whether or not a part of a skin exists
<#part "blahblah" () exists#>
<#part "blahblah" ($head->{topic_number}) exists#>
The above statements test to see whether the appropriate skin contains a part called "blahblah". If the part exists, the statement is replaced with 1. If the part does not exist, the statement is replaced with 0. It is most useful within an IF-THEN statement.
<#if <#part "blahblah" () exists#> == 1#>
Blahblah exists!
<#else#>
Blahblah does not exist!
<#endif#>
Parts of skins
<#part "dynamic_top"#>
...
<#/part#>
Within skin files, there are various "parts" -- for example, the part that generates the message pages, the part that generates individual messages, the part that generates the topic page, and the part that generates the preview when posting a new message. The following parts have a special meaning to the program and should not be changed:
page: This generates Discus message pages. It replaces much of the functionality of newpage.conf and subtopics.conf from previous Discus versions.
individual_message: This defines the format for each individual message. It is called many times from the "page" part. It replaces messages.conf from previous Discus versions.
addmessage-disabled: This is the "All posting is disabled" replacement for the Add a Message box.
addmessage-private: This is the "Add a Message" box for a private posting area. It replaces addmessage-private.conf from previous Discus versions.
addmessage-public: This is the "Add a Message" box for a public posting area. It replaces addmessage-public.conf from previous Discus versions.
topics: This is the topics page for the board.
newconv: This is the "start new thread" (formerly "Create New Conversation") screen, displayed in the user interface to allow users to start a new discussion page.
preview: Used to generate a preview of a post.
dynamic_top: Nearly all user interface screens and skins use this section to define the top of the page, including the <body> tag. Something that will appear on every screen in the user interface can be added to this section.
dynamic_bottom: Nearly all user interface screens and skins use this section to define the bottom of the page. There is generally no content after this section. Something that will appear at the bottom of every screen in the user interface can be added to this section.
navbar: This is the navigation bar for Discus message pages.
no_frames_buttons: When a frameless installation is detected, this section generates a button bar, link bar, or other HTML code designed to replace the functionality of the board's main menu.
INIT: This part is executed before anything else from the skin is executed. Generally this will contain definitions of arrays (such as user statuses and subtopic icons). You will get unexpected and inconsistent results if you actually put text in this section.
info: This part contains information for the Appearance Manager. It is not intended to be inserted using <#insert part...#>, as it would show up as unformatted text and look bad. Generally you will change this part only if you develop your own skin that you want to redistribute.
cookie_icons_offset: This part contains JavaScript code that calculates the difference between the server's time and the browser's time, for the purpose of updating JavaScript-based "NEW!" icons if they are enabled.
options_screen: If defined, a "Skin" tab will be automatically added to Options Manager, allowing the setting of options specific from this skin. Please refer to the skin developer's guide for additional formatting and variables available for this section.
|