Template variables.
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.
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:
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 |
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 |
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 |
useremail | the e-mail address of the user, empty if the e-mail address was not provided by the user |
userwebsite | the URL of the users website, empty if the URL was not provided by the user |
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 |
blogurl | URL 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 |
excerpt | the body of the comment, cut at 60 characters and appended with '…' |
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 |
Inserts the name of the author
Optional:
<%author%> <%author(realname)%> <a href="<%author(url)%>"><%author%></a>
Inserts a comments 'block'. More information about the structure of this block.
Optional:
Name | Contents |
---|---|
MaxToShow | Amount of comments to show (when set, this overrides the max. comments blogsetting) |
<%comments%> <%comments(5)%>
Inserts a date using the date format specified in the template. Optionally, a custom date format can be given as a parameter.
Optional
Four special parameters are possible:
rfc822
: RFC822 date in local timerfc822GMT
: RFC date in GMT timeiso8601
: ISO-8601 date (W3C Date and Time Format profile). Example: 2002-10-02T10:00:00-05:00utc
: Same as iso8601, but the date is expressed in UTC, using a “Z” for the timezone indicator.<%date%> <%date(%x)%> <%date(rfc822)%> <%date(rfc822GMT)%>
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.
An example for the item body template
<h1><%title%></h1> <p><%body%> <%morelink%></p> <div class="metadata"> <%edit%> <%comments%> </div>
This is an item
edit - 5 comments
Insert a link to the 'edit item' bookmarklet. This can be used in the editlink template for simplicity.
The 'edit link'-template could look like this:
<a href="<%editlink%>" onclick="<%editpopupcode%>">edit</a> -
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.
See the example for the editlink templatevar
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.
^ 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 |
<%image(myphoto.jpg|100|200|this is me)%> <%image(myphoto.jpg|50%|50%|this is me, but smaller)%>
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
Optional:
<%karma(posp)%> out of <%karma(votes)%> were positive
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.
^ Name ^ Contents ^
filename | Name of the image file (file gets) |
text | descriptive text for the media object |
<%media(mysong.mp3|listen to my new song)%>
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.
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.
^ 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 |
<%popup(myphoto.jpg|100|200|this is me)%> <%popup(myphoto.jpg|50%|50%|this is me, but smaller)%>
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.
Part | Empty? | |
---|---|---|
Body | No | No |
Extended | Yes | No |
smartbody= | body part | extended part |
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.
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.
^ Name ^ Contents ^
MaxChars | Maximum amount of characters to keep (defaults to 250) |
<%syndicate_description%> <%syndicate_description(25)%>
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.
^ Name ^ Contents ^
MaxChars | Maximum amount of characters to keep (defaults to 100) |
<%syndicate_title%> <%syndicate_title(25)%>
On comments-releated templateparts, inserts the title of the associated item.
Optional:
Inserts a time using the time format specified in the template. Optionally, a custom time format can be given as a parameter.
Optional
<%time%> <%time(%X)%>