User Tools

Site Tools


nupusi:nucleus:helptemp

Nucleus CMS Template items

The template items that make up a Nucleus template.

Templates: Archive Lists

The archive lists are formatted as listed below:

archivelist header
  archivelist listitem (repeated for each archive)
archivelist footer

Available variables: (in the header and footer, only blogid is allowed)

Name Description
blogidID of the weblog
archivelinklink to the archive, which you can embed in a <a href=“..”> tag.
monthNumber of the month (2 digits: 01-12)
yearYear (4 digits)
dayDay of month (2 digits; only when in day mode)

A more flexible way to add the date of the archive to the listitem, is to use strftime variables. If you find this too complicated, use the following:

<a href="<%archivelink%>">%B, %Y</a><br />

To change the language to your local settings, change the locale.

Templates: Category Lists

The category lists are formatted as listed below:

categorylist header
  categorylist listitem (repeated)
categorylist footer

Available variables: (in the header and footer, only blogid, blogurl and self are allowed)

Name Description
blogidID of the weblog
blogurlURL of the blog (as defined in blogsettings)
selfCurrent page, without parameters (e.g. index.php)
catlinka link to the most recent items for a category, which you can embed in a <a href=“..”> tag.
catidCategory ID
catnameCategory name
catdescCategory description
  • Examples
<ul>
  <li><a href="<blogurl%>">All</a></li>

List Item

<li><a href="<%catlink%>"><%catname%></a></li>
</ul>

Results in:

  • All
  • myCategory
  • yourCategory

Templates: Comment body

This is the part of the template used to display a single comment. In this template-part, comments-related templatevars are available.

  • Examples
<h2>Comment by <%userlink%>:</h2>

<p><%body%></p>

<div class="metadata">
 (from <%host%> on <%date%> at <%time%>)
</div>

Result:

Comment by karma:

Nice!

(from host.example.org on 2003-03-02 at 13:30)

Templates: Comment headers/footers

While the comments-body is repeated for each comment, the header and footer are only displayed once. A typicall structure would look like this:

comments header
  comments body 1
  comments body 2
  comments body 3
comments footer

In these template-parts, comments-related templatevars are available

  • Examples

Header:

<ul>

Body:

<li><%user%>: <%body%></li>

Footer

</ul>

Result

  • karma: nice!
  • xiffy: yes indeed!

Templates: Comments

There are three possible structures for a comments block.

  1. When comments are displayed (like on detail pages, or on the main page when there are less than the maximum allowed amount of comments)
comments header
  comments body (repeated)
comments footer
  1. When there are no comments at all
no comments
  1. When there are comments, but there are more than the maximum allowed number. (only applies when not on a detailed item page)
too much comments

Inside these template-parts, some comments-related variables are available

Templates: Comments Read More

This is the format of the link that will be added at the end of <%short%>, which is a variable for use in the comment body

Inside this template-part, some comments-related variables are available (except for the <%short%> variable).

  • Examples
 <a href="<%itemlink%>">[more]</a>

Templates: commentword

Most likely, you'll rather want to write “1 comment” than “1 comment(s)”. The “One comment” and “Many comments” template parts can be used for this purpose. They will be used to fill the <%commentword%> variable that you can use elsewhere.

If there is only 1 comment, <%commentword%> will be equal to the contents of the “one comment” part. If there are many comments (more than one), <%commentword%> will be equal to the contents of the “two (or more) comments” part.

Typical values are “comment” and “comments”. No special variables can be used here.

Template: Date headers/footers

The date header and date footer can contain date and time vars. More info on the available vars. If you want to get started quickly, use “%x” to format the date. The language which is used to format the date, is determined by the locale-setting in the template.

In the date header, the template variable <daylink> is allowed to insert a link to the archive for that day. Note the double '%'! It's necessary to avoid %d to be expanded as the current day of the month. Also, if you just want to add a '%' character somewhere, you should also put it twice ('') or it will be gone on your website. Sample for date header: <code> <div class="day"> <h1>%d %B</h1> </code> Sample for date footer: <code> </div> </code> And another example for the date head using daylink <code> <div class="day"> <h1>%d %B</h1> <a href="<daylink%%>“>(archive)</a> </code>

Templates: Date and Time formats

These are used to format dates and times into the <%date%> and <%time%> vars (see template vars). The formatting is done according to the locale

More info on the available vars. If want to get started quickly, use ”%x“ to format the date and ”%X“ to format the time.

This template defines how the edit-templatevar will be marked up. You can use any of the template variables here.

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

Templates: Highlight

The highlighting is used when performing searches. This is actually used in a regular expression, so you might want to escape some characters by putting a backslash before them. The place where the highlighted word will come, is indicated by “\0”.

  • Examples
<span style='background-color:yellow'>\0</span>

Templates: Items

When items are shown, the following setup is repeated for each item:

item header
item body
item footer

These three blocks all refer to a template-part, which define what the result looks like.

  • Variables

Within these template, a series of so called template variables can be used to insert item data.

  • Examples

An example for the item body template:

<h1><%title%></h1>
 
<p><%body%></p>
 
<div class="metadata">
 <a href="<%itemlink%>">link</a> -
 <%date%> <%time%> -
 <a href="<%authorlink%>"><%author%></a> -
 <%comments%>
</div>

The result would become something like this:

This is an item

This is the text for the item

link - August 8th 2002 18:51 - karma - no comments

Templates: Link to extended entry

This is the template that will be used to format the morelink templatevar that is available in the item templates. Available variables are the same as in the item templates.

When there's no extended part of the item, the <%morelink%> templatevar will have no effect.

  • Examples
<a href="<%itemlink%>">[Read More!]</a>

Templates: Locale

This is actually not a template-part, it's a setting. Setting it allows the date and time preferences when to be localized. Names of months and days will be in the desired language, etc.

The possible values depend according to which machine Nucleus is running on. Some possible values are

  • en: English
  • dutch: Dutch

More info in the Open Group Specification for strftime. (opens a new window)

The locale is used for the date and time format, for the dateheaders, and for the archivelist items

Templates: Media & Popups

These templates are used to format links to popup image windows and media objects (non-pictures). The available variables for each of the templates are described below

Name Description
popuplinkan <a href… link ready to use
rawpopuplinkonly the url inside href=”…“
popupcodejavascript code to open window
textthe alternate text (link text)
widthimage width
heightimage width
popuptext(=same as text)
linkdirect link to the image (URL)
mediaa non-popup A-tag to the image, ready to use

Inline Image Code

Name Description
imagean IMG-tag, ready to use
linkdirect link to the image (URL)
textthe alternate text (link text)
widthimage width
heightimage width
mediaan A-tag to the image, ready to use
Name Description
mediaan A-tag, ready to use
linkdirect link to the file (URL)
textthe alternate text (link text)

Templates: Member Extra

This is a template you can use to add an extra indication that a comment-author is a member. It ends up in the <%authtext%> variable for use in the comment body

Inside this template-part, some comments-related variables are available.

Template: 'New' indication

When the 'last visit' cookie option is activated, the contents of the 'Indication of new item'-template is copied into the <%new%> variable for items that have been added since the last visit. The <%new%> variable can e.g. be used in the item body-template.

When the 'last visit' cookie is disabled, or the item is not 'new', this template part will not be used.

Templates: nothing found

Shown when a search has been performed and no results were found.

Available variables:

Name Description
blogidID of the weblog
querythe query that was used in the search
  • Examples
No search results found for <b><%query%></b>
nupusi/nucleus/helptemp.txt · Last modified: 2008/12/06 13:56 (external edit)