The section object

The section object represents a content section.


countDocuments

Returns the number of documents in the section and any subsections. The path is always relative to the domain root directory. Nested subsections are separated by /.

Syntax:

countDocuments → number

Returns:

The number of documents in the section and any subsections.

Example:

Assuming a content structure like this:

- mydomain
  - Section1
      doc1
      doc2
      doc3 
    - Section1.1
        doc1.1
        doc1.2

Then the line:

<p>The number of documents in Section1 is
${liquidsite.findSection("Section1").countDocuments}.<p>

Will output:

The number of documents in Section1 is 5.


findDocument

Returns the document corresponding to a specified path. The path is always relative to the section. Nested subsections are separated by /.

Syntax:

findDocument(path) → document object

Parameters:

Returns:

The document specified by path inside the section.

Example:

This code finds a document and assigns it to a variable:

<#assign doc1 = liquidsite.findSection("Section1").findDocument("doc1")>

If the document was not found, doc1 will contain an empty document. This line checks whether doc1 is empty:

<#if doc1.name == "">

findDocuments

Returns all documents in the section and any subsections. The path is always relative to the section. Nested subsections are separated by /. The documents returned are ordered by modification date in descending order.

Syntax:

findDocuments(offset, count) → sequence of document objects

Parameters:

Returns:

A list of at most count documents in the section and any subsections, ordered by modified date in descending order, beginning at document number offset.

Example:

The next code loops through the four first documents in Section1.

<#list liquidsite.findSection("Section1").findDocuments(0, 4) as doc>

findDocuments

Returns a list of documents in the section and any subsections, ordered by a specified sort criterion. The path is always relative to the section. Nested subsections are separated by /.

Read about the sort criterion format in the liquidsite object findDocuments method.

Syntax:

findDocuments(sorting, offset, count) → sequence of document objects

Parameters:

Returns:

A list of at most count documents in the section and any subsections, ordered by the specified sorting criterion, beginning at document number offset.

Example:

The next code loops through the four first documents in Section1 ordered by parent section id and name in ascending order.

<#list liquidsite.findSection("Section1").findDocuments("+parent,+name", 0, 4) as doc>

findForum

Returns the named forum in this section.

Syntax:

findForum(name) → forum object

Parameters:

Returns:

The forum specified by name in this section.

Example:

This code finds a forum inside the section "Section1" and assigns it to a variable:

<#assign forum = liquidsite.findSection("Section1").findForum("forum1")>

If the forum was not found, forum will contain an empty forum. This line checks whether forum is empty:

<#if forum.name == "">

description

Returns the section description in HTML format.

Syntax:

description → string

Returns:

The section description in HTML format.

Example:

This code outputs the description of "Section1":

<#assign sec1 = liquidsite.findSection("Section1")>
<p>The section description is:</p>
${sec1.description}

Which will result in something like:

The section description is:

Section1.


forums

Returns all the section forums.

Syntax:

forums → sequence of forum objects

Returns:

All the section forums.

Example:

This code loops through the forums in "Section1":

<#list liquidsite.findSection("Section1").forums as forum>

sections

Returns all the section subsections.

Syntax:

sections → sequence of section objects

Returns:

All the section subsections.

Example:

This code loops through the subsections in "Section1":

<#list liquidsite.findSection("Section1").sections as sec>

created

Returns the section created date.

Syntax:

created → date

Returns:

The section created date.

Example:

This code outputs the section created date:

<#assign sec1 = liquidsite.findSection("Section1")>
<p>The section created date is ${sec1.created}.</p>

Which will result in something like:

The section created date is 2005-01-15.


date

Returns the section revision date.

Syntax:

date → date

Returns:

The section revision date.

Example:

This code outputs the section revision date:

<#assign sec1 = liquidsite.findSection("Section1")>
<p>The section revision date is ${sec1.date}.</p>

Which will result in something like:

The section revision date is 2005-01-21.


id

Returns the section id.

Syntax:

id → number

Returns:

The section id.

Example:

This code outputs the section id:

<#assign sec1 = liquidsite.findSection("Section1")>
<p>The section id is ${sec1.id}.</p>

Which will result in something like:

The section id is 123.


lock

Returns the section lock object.

Syntax:

lock → lock object

Returns:

The section lock object.

Example:

This code gets the lock object of a section and stores it in a variable:

<#assign lock = liquidsite.findSection("Section1").lock>

name

Returns the section name.

Syntax:

name → string

Returns:

The section name.

Example:

The following code obtains the name of a section and assigns it to a variable:

<#assign name = liquidsite.findSection("Section1").name>

online

Returns the section online flag.

Syntax:

online → boolean

Returns:

True if the section is online, false otherwise.

Example:

This code gets the online flag of a section and stores it in a variable:

<#assign online = liquidsite.findSection("Section1").online>

parent

Returns the parent section of the section.

Syntax:

parent → section object

Returns:

The parent section under which the section is located.

Example:

This code gets the parent of a section and stores it in a variable:

<#assign parent = liquidsite.findSection("Section1.1").parent>

In this case the parent of "Section1.1" is "Section1".


path

Returns the section path.

Syntax:

path → string

Returns:

The section path.

Example:

This code outputs the path of a section:

<#assign path = liquidsite.findSection("Section1").path>
<p>The path of "Section1" is ${path}.</p>

The result will be:

The path of "Section1" is Section1.


revision

Returns the section revision number.

Syntax:

revision → number

Returns:

The section revision number, or zero (0) if the section doesn't exist.

Example:

This code outputs the revision of a section:

<#assign revision = liquidsite.findSection("Section1").revision>
<p>The revision of "Section1" is ${revision}.</p>

The result will be something like:

The revision of "Section1" is 2.


user

Returns the section revision author.

Syntax:

user → user object

Returns:

The section revision author, or an empty user if the section doesn't exist.

Example:

This code gets the revision author of a section and assigns it to a variable:

<#assign user = liquidsite.findSection("Section1").user>

hasAccess

Checks whether the current logged in user has a specified permission over the section. See the document object for information about the allowed permission values.

Syntax:

hasAccess(permission) → boolean

Returns:

True if the current logged in user has the specified permission over the section, false otherwise.

Example:

This code checks whether the current logged in user has read access to a section:

<#if liquidsite.findSection("Section1").hasAccess("read")>