Template variables: Overview

What?

Template variables largely work in exact the same way as skin variables, with the only difference that they are being used inside templates. The variables are called using <%varname%>, and include some text depending on the variable function. Some variables also have extra optional parameters.

Available variables

These template variables be used in the following template-parts: item header, item body, item footer, date header, date footer, morelink, editlink (The variables image, popup and media can also be used inside weblog items.)

Comments-related template-parts (comments header, comments body, comments footer, one comment, two comments, comments read more, no comments, too much comments) have a different set of available variables:

Template Vars - Permalink

Template variables: Basic variables

All these variables concern the item that's currently being parsed.

Name Description
title item title
body body text
more extended text
category name of the category
categorylink raw link to the category
karma karma score
authorlink raw link to the author
itemlink raw permanent link for the item
author name of the author
smartbody either the body text or the extended text
morelink 'read more'-link
date Formatted date
time Formatted time
daylink raw link to the daily archive
comments comments block or commentcount
itemid ID of the item
blogurl URL of the blog

Template variables overview...

Template Vars - Permalink

Template variables: Advanced variables

All these variables concern the item that's currently being parsed.

Name Description
authorid ID of the current items author
blogid ID of the blog
catid ID of the category for the current item
query search query (if there is one)
syndicate_title Syndicated title
syndicate_description Syndicated body text
karmaposlink raw vote link
karmaneglink raw vote link
new 'New Item!'-text
include includes a file, whithout parsing
parsedinclude includes a file, parsing it
phpinclude includes a file, parsing by PHP
plugin executes a plugin
edit inserts an 'edit this item' link
editlink raw 'edit item' link (links to bookmarklet)
editpopupcode javascript code to open a popup window for editlink
skinfile includes the correct URL for a file belonging to an imported skin
set sets a parser property
image inline image from media library
popup popup image from media dir
media other media object from media dir
relevance Includes the 'search hit relevance' in templates that display search results

Template variables overview...

Template Vars - Permalink

Template variables: Comments

All these variables concern the item that's currently being parsed.

Name Description
body comment body
user user name
userid users URL or e-mail address
userlink a smart link to either the e-mail or URL for non members, or the member detail page for members. Note: this link already includes the <a href="..."> and </a> tags ! (when no valid URL or e-mail is available, only the name of the member will be shown)
userlinkraw same as above, but without the <a href.., empty when no valid URL or e-mail available
memberid ID of the member (0 for non-members)
commentcount total amount of comments for the item
commentword 1 'comment', 2 'comments'
date date on which comment was added
time time at which comment was added
host host from where comment was added
ip IP-address from where comment was added
commentid ID of the current comment
itemid ID of the current item
itemlink link to the detailed item page
itemtitle Title of the current item
blogid ID of the weblog
authtext the extra text for members, empty for non members
short a cut off version of the body, which truncates after the first line break. A link is added at the end according to the template
timestamp time at which comment was added
include includes a file, whithout parsing
parsedinclude includes a file, parsing it
phpinclude includes a file, parsing by PHP
plugin executes a plugin
skinfile includes the correct URL for a file belonging to an imported skin
set sets a parser property

Template variables overview...

Template Vars - Permalink

Templatevar: author

Inserts the name of the author

Arguments

    Optional:
    • what: Choose a type of information to be displayed:
      • name: display name (default)
      • realname: the real name of the author instead of the display name
      • id: Nucleus membet ID
      • url: URL of members website
      • email: email address of member (use of this one should be avoided)

Examples

<%author%>
<%author(realname)%>
<a href="<%author(url)%>"><%author%></a>

Template Vars - Permalink

Templatevar: comments

Inserts a comments 'block'. More information about the structure of this block.

Arguments

Examples

<%comments%>
<%comments(5)%>

Template Vars - Permalink

Templatevar: date

Inserts a date using the date format specified in the template. Optionally, a custom date format can be given as a parameter.

Arguments

    Optional
    • format: format to be used to format the date

Specials

Four special parameters are possible:

  1. rfc822: RFC822 date in local time
  2. rfc822GMT: RFC date in GMT time
  3. iso8601: ISO-8601 date (W3C Date and Time Format profile). Example: 2002-10-02T10:00:00-05:00
  4. utc: Same as iso8601, but the date is expressed in UTC, using a "Z" for the timezone indicator.

Examples

<%date%>
<%date(%x)%>
<%date(rfc822)%>
<%date(rfc822GMT)%>

Template Vars - Permalink

Templatevar: edit

From within your template, you can add an 'edit item' link by using this template variable. By default, it will link to a popup-bookmarklet-window, but that behaviour can be changed through the editlink template.

Note: only logged in members that are allowed to edit the item will see this link. In other cases, the edit-templatevar does nothing at all.

Example

An example for the item body template

<h1><%title%></h1>
<p><%body%> <%morelink%></p>
<div class="metadata">
	<%edit%> <%comments%>
</div>

Results in

Title

This is an item

Template Vars - Permalink

Templatevar: editlink

Insert a link to the 'edit item' bookmarklet. This can be used in the editlink template for simplicity.

Example

The 'edit link'-template could look like this:

<a href="<%editlink%>"
   onclick="<%editpopupcode%>">edit</a> -

Template Vars - Permalink

Templatevar: editpopupcode

To open a popup window for the 'edit link' window, you'll need to add some javascript code to your link. To avoid having to enter this code in the 'edit link'-template, you can insert it using the editpopupcode-templatevar.

Example

See the example for the editlink templatevar

Template Vars - Permalink

Templatevar: image

Inserts an inline image into an item body or template.

In normal use, the image-templatevar is generated automatically when adding images through the media library. You can call it from within templates too, though. Note that in this last case, the image will come out of the media dir of the current item's author.

Arguments

  • Required:

    Name Contents
    filename Name of the image file (file gets)
    width Width of the image (pixels or percentage)
    height Height of the image
    text alt-text for the image
  • Note: for the image, popup and media tags, the parameters must be separated by the '|' character, not by a comma!

Examples

<%image(myphoto.jpg|100|200|this is me)%>
<%image(myphoto.jpg|50%|50%|this is me, but smaller)%>

Template Vars - Permalink

Templatevar: karma

Inserts karma votes data. Karma votes are a method to vote the 'karma' of an item. With a single click, the visitor can vote either positive or negative. The total of all these votes gives an idea of how much an item is liked by the visitors

Arguments

    Optional:
    • what: Choose a type of information to be displayed:
      • totalscore: the total karma vote score (=amount of positive votes minus the amount of negative votes) (default)
      • pos: total number of positive votes
      • neg: total number of negative votes
      • votes: total number of votes
      • posp: percentage of votes that is positive
      • negp: percentage of votes that is negative

Examples

<%karma(posp)%> out of <%karma(votes)%> were positive

Template Vars - Permalink

Templatevar: media

Inserts a media object into an item body or template.

In normal use, the media-templatevar is generated automatically when adding images through the media library. You can call it from within templates too, though. Note that in this last case, the object will come out of the media dir of the current item's author.

Arguments

  • Required:

    Name Contents
    filename Name of the image file (file gets)
    text descriptive text for the media object
  • Note: for the image, popup and media tags, the parameters must be separated by the '|' character, not by a comma!

Examples

<%media(mysong.mp3|listen to my new song)%>

Template Vars - Permalink

Templatevar: morelink

Inserts a link to the detail page for the item, as defined in the template (link to extended entry). This is empty when there is no extended part.

Note that the contents of the 'link to extended entry' templatepart is also parsed and can thus also contain templatevariables.

Template Vars - Permalink

Templatevar: popup

Inserts a popup image into an item body or template.

In normal use, the popup-templatevar is generated automatically when adding images through the media library. You can call it from within templates too, though. Note that in this last case, the image will come out of the media dir of the current item's author.

Arguments

  • Required:

    Name Contents
    filename Name of the image file (file gets)
    width Width of the image (pixels or percentage)
    height Height of the image
    text alt-text for the image
  • Note: for the image, popup and media tags, the parameters must be separated by the '|' character, not by a comma!

Examples

<%popup(myphoto.jpg|100|200|this is me)%>
<%popup(myphoto.jpg|50%|50%|this is me, but smaller)%>

Template Vars - Permalink

Templatevar: smartbody

Examines the current item and then decides to show either the body text or the expanded text.

When the extended part is empty, the body part is chosen. Otherwise the extended part is shown.

PartEmpty?
BodyNoNo
ExtendedYesNo
smartbody=body partextended part

Example use

The body text could be interpreted as your full text, and the extended part could be interpreted as an 'introduction' or 'exerpt', which you want to show on the front page.

In the template used on the front page, you would use <%smartbody%> to insert an excerpt (if there is one), or the full text (if no excerpt). In the template for detailed items, <%body%> can then be used instead of the usual <%body%> + <%more%>, since <%body%> will contain the full item anyway.

Template Vars - Permalink

Templatevar: syndicate_description

Inserts the body of the item, with HTML tags-stripped off, and shortened to 250 characters. When the text needs to be shortened, "..." is added at the end of the text.

This variable was originally intended for use in the XML-RSS skin that comes with Nucleus, but can also be of use in other situations.

Arguments

  • Optional:

    Name Contents
    MaxChars Maximum amount of characters to keep (defaults to 250)

Examples

<%syndicate_description%>
<%syndicate_description(25)%>

Template Vars - Permalink

Templatevar: syndicate_title

Inserts the title of the item, with HTML tags-stripped off, and shortened to 100 characters. When the text needs to be shortened, "..." is added at the end of the text.

This variable was originally intended for use in the XML-RSS skin that comes with Nucleus, but can also be of use in other situations.

Arguments

  • Optional:

    Name Contents
    MaxChars Maximum amount of characters to keep (defaults to 100)

Examples

<%syndicate_title%>
<%syndicate_title(25)%>

Template Vars - Permalink

Templatevar: templateitemtitle

On comments-releated templateparts, inserts the title of the associated item.

Arguments

Template Vars - Permalink

Templatevar: time

Inserts a time using the time format specified in the template. Optionally, a custom time format can be given as a parameter.

Arguments

    Optional
    • format: format to be used to format the time

Examples

<%time%>
<%time(%X)%>

Template Vars - Permalink