DiaWebLog Theme Help
A weblog's theme controls how the weblog looks. DiaWebLog uses the theme to generate the weblog's front page, archive, search page, item page, and web comment page. New weblogs use the diaweblog_html_default theme.
You can create a new theme for your weblog, customize it's current theme, or just use the default theme. This page explains how to create and customize a theme.
Before you begin
HTML is a markup language for creating web pages. You will need to know some HTML to create or customize a theme. Check out W3Schools if you want to learn HTML or need a good online reference.
DiaWebLog themes use HTML 4.01 (Transitional). This version of HTML is supported by all modern browsers.
Creating a theme
To create a theme, log in and go to your user account. Under the Themes tab, click Create Theme. This will take you to the Create Theme page.
Now fill out the form. Name should be a short name without any spaces (e.g. cooltheme). To use the theme, DiaWebLog users would enter this name in the Theme Name field in their Weblog Account page. Full name can be a longer name for your theme (e.g. David's Cool Theme). The new theme will be a copy of the Start from theme. The default DiaWebLog theme is used by default. We recommend using this if this is your first theme. Click Create to create the theme.
After creating the theme, click the Edit link to go to the Theme Edit page. Later, you can get back to the Theme Edit page via the Themes tab in your User Account page.
Editing a theme
To edit one of your themes, log in and go to your user account. Select the Themes tab and then click a theme's name.
The Info tab has basic information about your theme. Name is the theme's official name. To use the theme, DiaWebLog users would enter this name in the Theme Name field in their Weblog Account page. This cannot be changed. Full name is the theme's full name. Description is a brief description of the theme. The other four tabs - Body, Items, Comments, and Polls - contain the theme's template.
The Preview button allows you to see how your theme will look with an actual weblog. The default weblog for previewing is test, which is just random gibberish. After you are done previewing a theme, press your browser's back button to go back to the theme edit page. When you are done, click Save to save your changes. Note that weblogs that use the theme are not updated immediately.
How themes work
A theme is a set of templates. A template is a short string of text. A template is used to generate one or more parts of a page. For example, the template for Body Start might be "Welcome to my weblog". Then, when DiaWebLog generates the start of the weblog's body it will output "Welcome to my weblog".
Variables are special words that can appear in templates and are replaced with specific data or content when the page is generated. For example, if today is Tuesday then every instance of [DAYNAME] in a template will be replaced with "Tuesday" when the page is generated. Variable names are always in upper-case and often contain underscores (_'s). In the template, variable names are always inside square brackets. The square brackets are removed when the variable is used.
Here's an example Comment template:
([COMMENT_POSTER]) [COMMENT_TEXT]Suppose we were generating the HTML for a comment posted by "monkey", who said "Themes are cool". DiaWebLog would use the above template and replace [COMMENT_POSTER] with "monkey" and [COMMENT_TEXT] with "Themes are cool". This would be the output:
(monkey) Themes are coolTemplates are often used to generate variables that are then used in other templates. Some templates are built-in to DiaWebLog. For example, the Item template is built-in. This template uses the variable ITEM_BYLINE which is generated from the Item Byline template. The built-in Item template looks like this:
[ITEM_START][ITEM_HEADLINE][ITEM_BYLINE][ITEM_POLL] [ITEM_COMMENTS][ITEM_END]
Variables
Weblog variables
These variables are set based on the weblog's configuration. They can be used in all templates.
Name Description NAME Weblog name FULLNAME Full name DESCRIPTION Description URL Front page URL TEXT_URL Text edition URL RSS_URL RSS Feed URL ARCHIVE_URL Archive URL OLDER_URL Page of older items URL NEWER_URL Page of newer items URL NAV_LINKS Links for older/newer items Time variables
These variables are set based on the time the page is generated. They can be used in all templates.
Name Description DATE Date (equivalent to "[YEAR]-[MONTHMONTH]-[DAYDAY]") TIME Time (equivalent to "[HOURHOUR]-[MINUTE]-[SECOND]") YEAR Year (0000-9999) MONTH Month (1-12) MONTHMONTH Month (01-12) (uses two digits) MONTHNAME Month (January, February, etc.) DAY Day (1-31) DAYDAY Day (01-31) (uses two digits) DAYNAME Day of week (Monday, Tuesday, etc.) HOUR Hour (1-12) HOURHOUR Hour (01-12) (uses two digits) HOUR24 Hour (0-23) HOUR24HOUR24 Hour (00-23) (uses two digits) MINUTE Minute (00-59) SECOND Second (00-59) AMPM AM or PM GMDATE Date (in GMT timezone) GMTIME Time (in GMT timezone) Similar variables are used in the Item templates for the time an item was posted. These variables start with "ITEM_" followed by one of the above variable names. For example, ITEM_DAYNAME is the day of the week the item was posted.
Time variables starting with "DAY_" can be used in the two Day templates. Time variables starting with "COMMENT_" can be used in the Comment templates for the time a comment was posted.
Body tab
The Body templates are used at the top and bottom of the web page, between days, and between items.
Header is a built-in template and is used at the very beginning of the page. DiaWebLog sets the variable TITLE depending on the page. The title of the weblog's front page is "[FULLNAME]". Footer is also a built-in template and is used at the very end of the page.
Head is used to set the variable HEAD, which is used in Header. Typically Head contains a CSS stylesheet. Head can by customized by the weblog's owner.
Body Start is used after Header and before Items Start. Body End is used before Footer but after Items End. Both are always used, even if there are no items. Both can be customized by the weblog's owner. These templates can be used to add a sidebar.
Items Start is used after Body Start and before the first item. Items End is used before Body End and after the last item. These templates are not used if there are no items. Items Between is used between every two of items.
Day Start is used before the first item of a day of items (e.g. before all items posted on Tuesday). Day End is used after the last item of a day of items. To output the day's date, use the time variables, but with "DAY_" in front of them. For example, for the Tuesday items, DAY_DAYNAME is set to "Tuesday".
Special rule: When either Day Start or Day End is used, Items Between is not used between two items from different days. This makes it easier to place a day's items within a division or table cell.
Items tab
The Items templates are used to generate an item's headline and byline.
Item Start is used before the item and Item End after the item.
An item has a headline and a byline. The headline appears first. One of four headline templates are used depending on whether the item has a title, a URL, both, or neither. The byline is set using the Byline template.
If there is a poll, the poll will follow the byline. The comments appear last, if there are comments.
These variables are set based on the item:
Name Description ITEM_TITLE Title ITEM_URL URL ITEM_LETTER_ID Letter ID (in parenthesis) ITEM_ID Number ID ITEM_POSTER Poster's name ITEM_WEB_COMMENT_COUNT Number of web comments ITEM_WEB_COMMENTS "1 Comment" or "N Comments" (N is a number) ITEM_LETTER_ID is blank if there is no letter ID. Only the most recent 25 items have letter IDs. To output the date and time the item was posted, use the time variables, but with "ITEM_" in front of them. For example, if the item was posted on Thursday then ITEM_DAYNAME is set to Thursday.
Comments tab
An item's comments appear after its byline (or after its poll if it has a poll).
Comments Blank is used if there are no comments. Otherwise, Comments Start is used at the beginning of the group of comments and Comments End at the end. Comments Between is used between two comments. Comment is used to generate the actual comment. These templates are all that are needed to display one line per comment without comments.
To group together comments by a single poster, use Start Poster and End Poster. Start Poster is used before a poster's first comment. End Poster is used after a poster's last comment. Special rule: If either of these templates is used, Comment Between will not appear between two comments by different posters. This makes it easier to place a poster's comments within a division or table cell.
A weblog's owner can assign icons to posters in their weblog account page. If a poster has an icon, the Start Poster with Icon template is used instead of Start Poster and Comment with Icon instead of and Comment. The variable COMMENT_POSTER_ICON is set to the URL of the icon.
The following variables are set in the Comments templates:
Name Description COMMENT_POSTER Poster's name COMMENT_POSTER_ICON Poster's icon COMMENT_TEXT Comment's text To output the date and time the comment was posted, use the time variables, but with "COMMENT_" in front of them. For example, if the comment was posted on Thursday then COMMENT_DAYNAME is set to Thursday. COMMENT_POSTER_ICON is only set if the poster has an icon.
Polls tab
Poll results appear after an item's byline and before its comments.
Poll Start is used at the beginning of a poll and Poll End at the end.
For each poll option, Option with Votes or Option with No Votes is used, depending on whether anyone has voted for the option. Options Between is used between every two options.
Poll Colors is a list of colors that can be used for bars in the bar graph. A color can be a hexadecimal value or one of the sixteen HTML colors with names. There should be a space or comma between colors. This does not need to be set if the POLL_OPTION_COLOR variable is never used.
The following rules are automatically defined for POLL rules:
Name Description POLL_VOTE_COUNT Total number of votes POLL_VOTES the text "1 Vote" or "N Votes" POLL_OPTION_NAME Option name POLL_OPTION_VOTE_URL URL for voting option for online POLL_OPTION_VOTES Number of votes for option POLL_OPTION_PERCENT Percent of all votes for option POLL_OPTION_GPERCENT Fraction of votes multiplied by 400 POLL_OPTION_COLOR HTML color for option POLL_OPTION_GPERCENT is a number between 0 and 400, proportional to the number of votes. This can be used to display a bar in a bar graph.
Need more help?
If you have questions, comments, or suggestions, email support@diaweblog.com.
