Skip to the content
Documentation

Template override conditions

No ratings yet

This section contains an overview of the override conditions that can be used to override the system templates.

Override example

[magic_pockets]                (1)
Source=node/view/full.tpl      (2)
MatchFile=magic_pocket.tpl     (3)
Subdir=templates               (4)
Match[class_identifier]=pocket (5)
Match[section]=34              (6)
...                            ...
  1. The name of the override.
  2. The template that should be overridden.
  3. The alternate template that should be used.
  4. The location of the override templates.
  5. Match condition #1
  6. Match condition #2

class/edit.tpl

Module/view: class / edit

Condition Description
class Matches the ID number of the class.

class/groupedit.tpl

Module/view: class / groupedit

Condition Description
object Matches the ID number of class group.

class/view.tpl

Module/view: class / view

Condition Description
class Matches the ID number of the class.
class_identifier Matches the identifier of the class (for example "folder").

content/advancedsearch.tpl

Module/view: content / advancedsearch

Condition Description
section Matches the number of the section in which the search was conducted.

content/browse.tpl

Module/view: content / browse

Condition Description
object Matches the ID number of the object.
node Matches the ID number of the node.
parent_node Matches the ID number of the parent node.
class Matches the ID number of the class which the object is an instance of.
class_identifier Matches the identifier of the class which the object is an instance of.
view_offset Matches the offset view parameter.
depth Matches the depth of the node. The depth of a top level node is 1.
navigation_part_identifier Matches the identifier of the navigation part.
url_alias Matches the virtual URL of the node.

content/collectedinfo/*.tpl

Module/view: content / collectinformation

Condition Description
object Matches the ID number of the object.
node Matches the ID number of the node.
parent_node Matches the ID number of the parent node.
class Matches the ID number of the class which the object is an instance of.
class_identifier Matches the identifier of the class which the object is an instance of.
depth Matches the depth of the node. The depth of a top level node is 1.
navigation_part_identifier Matches the identifier of the navigation part.
url_alias Matches the virtual URL of the node.

content/collectedinfo/*.tpl

Module/view: content / collectedinfo

Condition Description
object Matches the ID number of the object.
node Matches the ID number of the node.
parent_node Matches the ID number of the parent node.
class Matches the ID number of the class which the object is an instance of.
depth Matches the depth of the node. The depth of a top level node is 1.
navigation_part_identifier Matches the identifier of the navigation part.
url_alias Matches the virtual URL of the node.

content/collectedinfomail/*.tpl

Module/view: content / collectinformation

Condition Description
object Matches the ID number of the object.
node Matches the ID number of the node.
parent_node Matches the ID number of the parent node.
class Matches the ID number of the class which the object is an instance of.
class_identifier Matches the identifier of the class which the object is an instance of.
depth Matches the depth of the node. The depth of a top level node is 1.
navigation_part_identifier Matches the identifier of the navigation part.
url_alias Matches the virtual URL of the node.

content/datatype/edit/*.tpl

Module/view: none.

Condition Description
class_identifier Matches the identifier of the class.
attribute_identifier Matches the identifier of the attribute.

content/datatype/view/*.tpl

Module/view: none.

Condition Description
class_identifier Matches the identifier of the class.
attribute_identifier Matches the identifier of the attribute.

content/edit.tpl

Module/view: content / edit

Condition Description
object Matches the ID number of the object.
class Matches the ID number of the class which the object is an instance of.
class_identifier Matches the identifier of the class which the object is an instance of.
class_group Matches the ID number of the group that the class which the object is an instance of belongs to.

content/search.tpl

Module/view: content / search

Condition Description
section Matches the number of the section in which the search was conducted.

content/versions.tpl

Module/view: content / versions

Condition Description
object Matches the ID number of the object.
class Matches the ID number of the class which the object is an instance of.
class_identifier Matches the identifier of the class which the object is an instance of.
section_id Matches the number of the section which the object belongs to.

content/versionview.tpl

Module/view: content / versionview

Condition Description
navigation_part_identifier Matches the identifier of the navigation part.

layout/set.tpl

Module/view: layout / set

Condition Description
layout Matches the name of the layout (for example "print", "fullpage", etc.).

node/view/*.tpl

Module/view: content / view

Condition Description
object Matches the ID number of the object.
node Matches the ID number of the node.
parent_node Matches the ID number of the parent node.
class Matches the ID number of the class which the object is an instance of.
class_identifier Matches the identifier of the class which the object is an instance of.
view_offset Matches the offset view parameter.
depth Matches the depth of the node. The depth of a top level node is 1.
section Matches the number of the section which the object belongs to.
navigation_part_identifier Matches the identifier of the navigation part.
viewmode Matches the name of the view mode (full, line, etc.)
url_alias Matches the virtual URL of the node.
persistent_variable Matches the value of the persistent variable.
class_group Matches the ID number of the group that the class which the object is an instance of belongs to.

node/view/pdf.tpl

Module/view: content / pdf

Condition Description
object Matches the ID number of the object.
node Matches the ID number of the node.
parent_node Matches the ID number of the parent node.
class Matches the ID number of the class which the object is an instance of.
class_identifier Matches the identifier of the class which the object is an instance of.
depth Matches the depth of the node. The depth of a top level node is 1.
url_alias Matches the virtual URL of the node.
class_group Matches the ID number of the group that the class which the object is an instance of belongs to.

pagelayout.tpl

Module/view: none.

Condition Description
[any] The pagelayout may be overridden using the same keys that are available for the view which was used within the request. For example, if the "view" view of the "content" module was accessed, then the override conditions of that view will be matched. This makes it possible to create a pagelayout override that will be triggered when for example nodes referencing objects that belong to a certain section are requested.

workflow/edit.tpl

Module/view: workflow / edit

Condition Description
workflow Matches the ID number of the workflow.

workflow/groupedit.tpl

Module/view: workflow / groupedit

Condition Description
workflowgroup Matches the ID number of the workflow group.

workflow/view.tpl

Module/view: workflow / view

Condition Description
workflow Matches the ID number of the workflow.

In this section

Contributors

Comments (3 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. OR conditions

    Tristan Rivoallan ·

    Is there a way to specify OR conditions ? ie : node 43 OR node 56 ?

    1. Re: OR conditions

      Jan Kudlicka ·

      No, but you can place 2 groups in override.ini(.append.php) like in the following example:
      [magic_pockets_43]
      Source=node/view/full.tpl
      MatchFile=magic_pocket.tpl
      Subdir=templates
      Match[node]=43
      [magic_pockets_56]
      Source=node/view/full.tpl
      MatchFile=magic_pocket.tpl
      Subdir=templates
      Match[node]=56
      (Note that the group name must be diffent.)
      If you have set of many such nodes, you may consider creating a special class for those nodes or place them in special section (do not forget on permission settings in this case).

  2. Override a pagelayout_bodycontent

    Nguyen Tien Hy ·

    Suppose pagelayout.tpl as follows:
    "--------
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "" title="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{$site.http_equiv.Content-language|wash}" lang="{$site.http_equiv.Content-language|wash}">
    <head>
    {include uri="design:pagelayout_style.tpl"}
    {include uri="design:pagelayout_javascript.tpl"}
    {literal}
    <!--[if lt IE 6.0]>
    <style>
    div#maincontent-design { width: 100%; } /* This is needed to avoid width bug in IE 5.5 */
    </style>
    <![endif]-->
    {/literal}
    {include uri="design:page_head.tpl"}
    </head>
    <body>
    <div id="allcontent">
    <div id="topcontent">
    {include uri="design:pagelayout_topcontent.tpl"}
    </div>{* id="topcontent" *}
    <hr class="hide" />
    {include uri="design:pagelayout_topmenu.tpl"}
    <hr class="hide" />
    {include uri="design:pagelayout_path.tpl"}
    {include uri="design:pagelayout_bodycontent.tpl"}
    <hr class="hide" />
    {include uri="design:pagelayout_toolbarbottom.tpl"}
    {include uri="design:pagelayout_footer.tpl"}
    <div class="break"></div>
    </div>{* id="allcontent" *}
    <!--DEBUG_REPORT-->
    </body>
    </html>
    -------"
    I "override" pagelayout_bodycontent.tpl as follows:
    1. Put a new template in "frontpage/pagelayout_bodycontent.tpl".
    2. Write into override.ini.append.php
    [pagelayout_bodycontent_frontpage]
    Source=pagelayout_bodycontent.tpl
    MatchFile=frontpage/pagelayout_bodycontent.tpl
    Subdir=templates
    Match[node]=2
    But the result is not OK. The override pagelayout_bodycontent.tpl not run.

Comments

Add a comment

Comments are read by a moderator before they appear.