Cotonti Template Reference: Names, purpose, and examples of calling a custom function

Examples of calling a custom functions. In Cotonti, every template file has a unique name that is used for identification and loading by the system.

2026-08-20 12:32 · Published
8 min read
481
0

Cotonti Template Reference: Names, Purposes, and Examples of Calling Custom Functions

Introduction

In Cotonti, each template file has a unique name used for identification and loading by the engine. Knowing the correct template names is critical for developers and designers, as it allows you to:

  • Quickly find the file you need to edit;
  • Correctly use the cot_tpl_url() function to get the path to a template;
  • Create new templates following Cotonti naming standards;
  • Effectively debug layouts by understanding which template is responsible for a particular page or block.

This reference collects all the main template names, their purposes, and examples of calling the cot_tpl_url() function for various extension types. The material is divided into categories for easy searching:

  • Modules (module) — main site sections (pages, forums, users, etc.);
  • Plugins (plug) — additional functional blocks;
  • Core (core) — system templates used on all pages;
  • Admin panel — templates for site management.

This reference will help you quickly navigate the template structure of your site and correctly use the cot_tpl_url() function in your code.


Table of Contents


General Syntax

{PHP|cot_tpl_url('template_name', 'type', admin)}
  • 'template_name' — string name of the file without the .tpl extension (parts separated by dots). For example, 'page.list'.
  • 'type' — extension type: 'module' (default), 'plug', 'core'.
  • admin — boolean flag: true for admin templates (searches in the admin theme folder), otherwise you can omit it or pass false/null.

Important for cot_tpl_url(): this function accepts only string arguments (template name, type, flag). You cannot pass an array to it. If the template name is generated dynamically in PHP, compute it in advance and pass it to the template as a regular variable via $t->assign():

$tpl_url = cot_tpl_url($dynamic_name, 'module');
$t->assign('DYNAMIC_TPL_URL', $tpl_url);

In the template use {DYNAMIC_TPL_URL}.

Important: you can pass arrays and objects into ordinary template variables (not into cot_tpl_url()) – they are supported via dot notation ({user.name}) and FOR loops. The restriction on arrays applies only to the arguments of the cot_tpl_url() function, not to template data in general.


Module Templates

Page

  • page.tpl — displays a single site page: title, body, author, date, and comments.
    {PHP|cot_tpl_url('page')}
  • page.list.tpl — displays a list of pages within a selected category with pagination.
    {PHP|cot_tpl_url('page.list')}
  • page.add.tpl — shows the form for adding a new page by a user.
    {PHP|cot_tpl_url('page.add')}
  • page.edit.tpl — shows the form for editing an existing page.
    {PHP|cot_tpl_url('page.edit')}

Forums

  • forums.sections.tpl — displays a list of all forum sections with topic and post counts.
    {PHP|cot_tpl_url('forums.sections')}
  • forums.topics.tpl — displays a list of topics in a selected forum section.
    {PHP|cot_tpl_url('forums.topics')}
  • forums.posts.tpl — shows posts within a specific forum topic.
    {PHP|cot_tpl_url('forums.posts')}
  • forums.newtopic.tpl — displays the form for creating a new topic in a forum section.
    {PHP|cot_tpl_url('forums.newtopic')}
  • forums.editpost.tpl — shows the form for editing an individual forum post.
    {PHP|cot_tpl_url('forums.editpost')}

Users

  • users.details.tpl — displays detailed user information: profile, statistics, contacts.
    {PHP|cot_tpl_url('users.details')}
  • users.edit.tpl — displays the form for editing user profile data.
    {PHP|cot_tpl_url('users.edit')}
  • users.register.tpl — shows the registration form for a new account.
    {PHP|cot_tpl_url('users.register')}
  • users.profile.tpl — displays the public user profile for others to view.
    {PHP|cot_tpl_url('users.profile')}
  • users.passrecover.tpl — displays the password recovery form.
    {PHP|cot_tpl_url('users.passrecover')}

PM (Private Messages)

  • pm.list.tpl — shows a list of incoming and outgoing private messages for the user.
    {PHP|cot_tpl_url('pm.list')}
  • pm.message.tpl — displays the content of a single private message.
    {PHP|cot_tpl_url('pm.message')}
  • pm.send.tpl — displays the form for sending a new private message.
    {PHP|cot_tpl_url('pm.send')}

PFS (Personal File Storage)

  • pfs.tpl — main file manager interface: list of files and folders, upload.
    {PHP|cot_tpl_url('pfs')}
  • pfs.view.tpl — displays the contents of a specific file or folder in the file manager.
    {PHP|cot_tpl_url('pfs.view')}

Polls

  • polls.tpl — displays a poll with answer options and voting results.
    {PHP|cot_tpl_url('polls')}

RSS

  • rss.tpl — generates an RSS feed of the latest site materials.
    {PHP|cot_tpl_url('rss')}

Index

  • index.tpl — the main page of the site, typically showing latest materials and widgets.
    {PHP|cot_tpl_url('index')}

Plugin Templates

For plugins, always specify the type 'plug'.

Recent Items

  • recentitems.tpl — displays a list of recently added or updated site materials.
    {PHP|cot_tpl_url('recentitems', 'plug')}

Comments

  • comments.tpl — displays all comments on a specific item with an add form.
    {PHP|cot_tpl_url('comments', 'plug')}
  • comments.edit.tpl — shows the form for editing an individual comment.
    {PHP|cot_tpl_url('comments.edit', 'plug')}

Tags

  • tags.tpl — displays a tag cloud or a list of items related to a selected tag.
    {PHP|cot_tpl_url('tags', 'plug')}

Sitemap

  • sitemap.tpl — displays a site map with links to all sections and materials.
    {PHP|cot_tpl_url('sitemap', 'plug')}
  • sitemap.index.tpl — shows the index of the site map for pagination across multiple pages.
    {PHP|cot_tpl_url('sitemap.index', 'plug')}

Ratings

  • ratings.tpl — displays item ratings and voting controls.
    {PHP|cot_tpl_url('ratings', 'plug')}

Contact

  • contact.tpl — displays a contact form for sending messages to the administration.
    {PHP|cot_tpl_url('contact', 'plug')}

Hits

  • hits.admin.tpl — admin panel for visit statistics: graphs, counters, reports.
    {PHP|cot_tpl_url('hits.admin', 'plug', true)}

Banlist

  • banlist.admin.tpl — admin panel for managing blocked users and IP addresses.
    {PHP|cot_tpl_url('banlist.admin', 'plug', true)}

System Templates (Core core)

  • header.tpl — common site header: logo, menu, meta tags, included on all pages.
    {PHP|cot_tpl_url('header', 'core')}
  • footer.tpl — common site footer: copyright, additional links, scripts, included on all pages.
    {PHP|cot_tpl_url('footer', 'core')}
  • message.tpl — displays system messages, errors, and notifications to the user.
    {PHP|cot_tpl_url('message', 'core')}

Admin Panel Templates

Admin Core

  • admin.home.tpl — main admin panel page with system overview.
    {PHP|cot_tpl_url('admin.home', 'core', true)}
  • admin.main.tpl — main admin panel layout: general markup, menu, sidebar.
    {PHP|cot_tpl_url('admin.main', 'core', true)}
  • admin.config.tpl — site main settings configuration page.
    {PHP|cot_tpl_url('admin.config', 'core', true)}
  • admin.extensions.tpl — manage installed modules and plugins: enable, disable, configure.
    {PHP|cot_tpl_url('admin.extensions', 'core', true)}
  • admin.users.tpl — manage users: edit, block, delete accounts.
    {PHP|cot_tpl_url('admin.users', 'core', true)}
  • admin.structure.tpl — manage site structure: categories, sections, their order and parameters.
    {PHP|cot_tpl_url('admin.structure', 'core', true)}
  • admin.extrafields.tpl — configure extra fields for various entities.
    {PHP|cot_tpl_url('admin.extrafields', 'core', true)}
  • admin.cache.tpl — manage site cache: clear, adjust expiration time.
    {PHP|cot_tpl_url('admin.cache', 'core', true)}
  • admin.cache.disk.tpl — disk cache details: view and clear individual cache files.
    {PHP|cot_tpl_url('admin.cache.disk', 'core', true)}
  • admin.log.tpl — view system event log: user actions, errors.
    {PHP|cot_tpl_url('admin.log', 'core', true)}
  • admin.rights.tpl — configure user group permissions.
    {PHP|cot_tpl_url('admin.rights', 'core', true)}
  • admin.rightsbyitem.tpl — detailed permission settings for a specific site item.
    {PHP|cot_tpl_url('admin.rightsbyitem', 'core', true)}
  • admin.other.tpl — miscellaneous administrative settings not covered elsewhere.
    {PHP|cot_tpl_url('admin.other', 'core', true)}
  • admin.phpinfo.tpl — displays PHP configuration information.
    {PHP|cot_tpl_url('admin.phpinfo', 'core', true)}
  • admin.infos.tpl — shows system summary information about Cotonti and its environment.
    {PHP|cot_tpl_url('admin.infos', 'core', true)}

Admin Module Templates

  • page.admin.tpl — admin panel for managing pages: bulk operations, categories.
    {PHP|cot_tpl_url('page.admin', 'module', true)}
  • forums.admin.tpl — admin panel for managing the forum: sections, topics, moderation.
    {PHP|cot_tpl_url('forums.admin', 'module', true)}
  • polls.admin.tpl — admin panel for managing polls: creation and editing.
    {PHP|cot_tpl_url('polls.admin', 'module', true)}
  • pfs.admin.tpl — admin panel for the file manager: settings, limitations.
    {PHP|cot_tpl_url('pfs.admin', 'module', true)}

Admin Plugin Templates

  • recentitems.admin.tpl — admin panel for the Recent Items plugin: configuration of recent material output.
    {PHP|cot_tpl_url('recentitems.admin', 'plug', true)}
  • comments.admin.tpl — admin panel for the Comments plugin: comment moderation.
    {PHP|cot_tpl_url('comments.admin', 'plug', true)}
  • tags.tools.tpl — tools for the Tags plugin: bulk tag management.
    {PHP|cot_tpl_url('tags.tools', 'plug', true)}

Summary Table of Templates

CategoryTemplate NamePurposeExample Call
Pagepage.tplDisplay a single page{PHP|cot_tpl_url('page')}
page.list.tplList pages in a category{PHP|cot_tpl_url('page.list')}
page.add.tplAdd page form{PHP|cot_tpl_url('page.add')}
page.edit.tplEdit page form{PHP|cot_tpl_url('page.edit')}
Forumsforums.sections.tplList forum sections{PHP|cot_tpl_url('forums.sections')}
forums.topics.tplList topics in a section{PHP|cot_tpl_url('forums.topics')}
forums.posts.tplPosts within a topic{PHP|cot_tpl_url('forums.posts')}
forums.newtopic.tplNew topic form{PHP|cot_tpl_url('forums.newtopic')}
forums.editpost.tplEdit post form{PHP|cot_tpl_url('forums.editpost')}
Usersusers.details.tplDetailed user profile{PHP|cot_tpl_url('users.details')}
users.edit.tplEdit profile form{PHP|cot_tpl_url('users.edit')}
users.register.tplRegistration form{PHP|cot_tpl_url('users.register')}
users.profile.tplPublic profile{PHP|cot_tpl_url('users.profile')}
users.passrecover.tplPassword recovery form{PHP|cot_tpl_url('users.passrecover')}
PMpm.list.tplList of private messages{PHP|cot_tpl_url('pm.list')}
pm.message.tplSingle message content{PHP|cot_tpl_url('pm.message')}
pm.send.tplSend message form{PHP|cot_tpl_url('pm.send')}
PFSpfs.tplMain file manager interface{PHP|cot_tpl_url('pfs')}
pfs.view.tplView file/folder contents{PHP|cot_tpl_url('pfs.view')}
Pollspolls.tplPoll with answer options{PHP|cot_tpl_url('polls')}
RSSrss.tplRSS feed of latest materials{PHP|cot_tpl_url('rss')}
Indexindex.tplMain site page{PHP|cot_tpl_url('index')}
Pluginsrecentitems.tplList of recently added materials{PHP|cot_tpl_url('recentitems', 'plug')}
comments.tplComments with add form{PHP|cot_tpl_url('comments', 'plug')}
comments.edit.tplEdit comment form{PHP|cot_tpl_url('comments.edit', 'plug')}
tags.tplTag cloud or list by tag{PHP|cot_tpl_url('tags', 'plug')}
sitemap.tplSite map{PHP|cot_tpl_url('sitemap', 'plug')}
sitemap.index.tplSite map index{PHP|cot_tpl_url('sitemap.index', 'plug')}
ratings.tplItem ratings{PHP|cot_tpl_url('ratings', 'plug')}
contact.tplContact form{PHP|cot_tpl_url('contact', 'plug')}
Coreheader.tplSite header{PHP|cot_tpl_url('header', 'core')}
footer.tplSite footer{PHP|cot_tpl_url('footer', 'core')}
message.tplSystem messages and errors{PHP|cot_tpl_url('message', 'core')}
Admin panel (core, admin=true)admin.home.tplAdmin dashboard{PHP|cot_tpl_url('admin.home', 'core', true)}
admin.main.tplAdmin main layout{PHP|cot_tpl_url('admin.main', 'core', true)}
admin.config.tplSite configuration{PHP|cot_tpl_url('admin.config', 'core', true)}
admin.extensions.tplModule and plugin management{PHP|cot_tpl_url('admin.extensions', 'core', true)}
admin.users.tplUser management{PHP|cot_tpl_url('admin.users', 'core', true)}
admin.structure.tplSite structure management{PHP|cot_tpl_url('admin.structure', 'core', true)}
admin.extrafields.tplExtra fields configuration{PHP|cot_tpl_url('admin.extrafields', 'core', true)}
admin.cache.tplCache management{PHP|cot_tpl_url('admin.cache', 'core', true)}
admin.cache.disk.tplDisk cache details{PHP|cot_tpl_url('admin.cache.disk', 'core', true)}
admin.log.tplSystem event log{PHP|cot_tpl_url('admin.log', 'core', true)}
admin.rights.tplPermission settings{PHP|cot_tpl_url('admin.rights', 'core', true)}
admin.rightsbyitem.tplItem-specific permissions{PHP|cot_tpl_url('admin.rightsbyitem', 'core', true)}
admin.other.tplOther admin settings{PHP|cot_tpl_url('admin.other', 'core', true)}
admin.phpinfo.tplPHP information{PHP|cot_tpl_url('admin.phpinfo', 'core', true)}
admin.infos.tplSystem information{PHP|cot_tpl_url('admin.infos', 'core', true)}
Admin module templatespage.admin.tplPage management{PHP|cot_tpl_url('page.admin', 'module', true)}
forums.admin.tplForum management{PHP|cot_tpl_url('forums.admin', 'module', true)}
polls.admin.tplPoll management{PHP|cot_tpl_url('polls.admin', 'module', true)}
pfs.admin.tplPFS management{PHP|cot_tpl_url('pfs.admin', 'module', true)}
Admin plugin templatesrecentitems.admin.tplRecent Items configuration{PHP|cot_tpl_url('recentitems.admin', 'plug', true)}
comments.admin.tplComment moderation{PHP|cot_tpl_url('comments.admin', 'plug', true)}
tags.tools.tplTag management tools{PHP|cot_tpl_url('tags.tools', 'plug', true)}

Notes

  1. If type is not specified, 'module' is assumed.
  2. For plugins always specify 'plug'.
  3. For admin templates add the third parameter true.
  4. The third parameter of the cot_tpl_url($base, $type, $admin) function is $admin.

    • true — search in the admin theme (folder themes/admin/... or as specified in $cfg['admintheme']).
    • false or null (default) — search in the user theme, but if the name contains admin, Cotonti may automatically use the admin theme.

    Example: {PHP|cot_tpl_url('page.admin', 'module', true)} — looks for page.admin.tpl in the admin part of the theme. Without true, Cotonti may look for it in the regular theme, which could give an incorrect path.

  5. You cannot pass an array to cot_tpl_url() – it expects strings only. However, you can pass arrays to ordinary template variables ($t->assign()), and access their elements using dot notation (e.g., {user.profile.name}). Use the <!-- FOR ... IN ... --> construct to iterate over arrays.
  6. If the template name is generated dynamically, pass it to the template via $t->assign() from PHP:

    $tpl_url = cot_tpl_url($dynamic_name, 'module');
    $t->assign('DYNAMIC_TPL_URL', $tpl_url);

    In the template: {DYNAMIC_TPL_URL}

  7. Working with arrays in templates. If you assign an array to a variable:

    $t->assign('user', ['name' => 'John', 'age' => 30]);

    then in the template you can output {user.name} and {user.age}. You can also use arrays in loops:

    <!-- FOR {item} IN {items} -->
      {item.title}
    <!-- ENDFOR -->

    This is a standard CoTemplate feature and is not prohibited.

This is not a complete set of examples for all categories and template types, but it is enough to get you started.


Conclusion

This reference covers the main Cotonti template names, grouped by category. Use it to:

  • Quickly find the template you need when editing the site’s appearance;
  • Correctly call the cot_tpl_url() function in your code;
  • Understand the template structure of the system and its purposes.

The summary table at the end will help you quickly locate a template by category and get a ready‑to‑use example. If you don’t find a template in the list, refer to the documentation of the corresponding module or plugin.

Remember that template names may vary depending on the Cotonti version and the theme you are using. When in doubt, check the actual file names in the /themes/your_theme/ folder.


FULL INSTRUCTION FOR cot_tpl_url() – EVERY CASE WITH EXAMPLES

1. WHAT cot_tpl_url() RETURNS

Returns the absolute URL to the template file (e.g., https://site.com/themes/default/modules/page/page.list.tpl).
This is NOT a link to a site page – it is the path to the file for debugging, caching, or verification.


2. WHERE CAN IT BE CALLED

LocationSyntax
In PHP code (controller, hook, plugin)cot_tpl_url($base, $type, $admin)
In TPL template (via {PHP|...}){PHP|cot_tpl_url('...', '...', ...)}

3. WHAT CAN BE PASSED AS THE FIRST PARAMETER ($base)

Call locationCan pass stringCan pass array
PHP✅ yes✅ yes
TPL ({PHP|...})✅ yes❌ NO (strings only)

4. EXAMPLES FOR EACH CASE

CASE 1: CALL IN PHP WITH STRING

When: the template name is known and does not change, you are already in PHP.

// Example 1.1 – get URL of the page.list.tpl template
$url = cot_tpl_url('page.list', 'module');
// Result: https://site.com/themes/default/modules/page/page.list.tpl

// Example 1.2 – explicitly specifying the 'core' type
$header_url = cot_tpl_url('header', 'core');
// Result: https://site.com/themes/default/core/header.tpl

// Example 1.3 – admin template (third parameter true)
$admin_url = cot_tpl_url('admin.config', 'core', true);
// Result: https://site.com/themes/admin/core/admin.config.tpl

Explanation: first argument is the file name string without the .tpl extension; second is the type ('module', 'plug', or 'core'); third is true for the admin theme.

CASE 2: CALL IN PHP WITH ARRAY

When: the template name is assembled from several parts dynamically.

// Example 2.1 – array of two parts
$parts = ['page', 'list'];
$url = cot_tpl_url($parts, 'module');
// Equivalent to cot_tpl_url('page.list', 'module')

// Example 2.2 – dynamic name from variables
$module = 'forums';
$action = 'topics';
$url = cot_tpl_url([$module, $action], 'module');
// Result: URL to forums.topics.tpl

// Example 2.3 – array for a plugin
$plugin_parts = ['comments', 'edit'];
$url = cot_tpl_url($plugin_parts, 'plug');
// Result: URL to comments.edit.tpl in the plugins folder

Explanation: the array is converted to a string by joining elements with a dot. Works only in PHP, not in TPL.

CASE 3: CALL IN TPL WITH STRING (DIRECT CALL)

When: the template name is known and you want to get the URL directly in the template.

<!-- Example 3.1 – simple call -->
{PHP|cot_tpl_url('page.list', 'module')}

<!-- Example 3.2 – admin template -->
{PHP|cot_tpl_url('admin.home', 'core', true)}

<!-- Example 3.3 – plugin -->
{PHP|cot_tpl_url('recentitems', 'plug')}

Explanation: inside {PHP|...} all arguments must be strings. Arrays are not allowed.

CASE 4: PASSING RESULT FROM PHP TO TPL (RECOMMENDED)

When: the name is dynamic, or you want to use an array, or just for clean code.

Step 1 – in PHP:

$dynamic_name = ['page', 'list'];
$tpl_url = cot_tpl_url($dynamic_name, 'module');
$t->assign('TPL_DEBUG_URL', $tpl_url);

Step 2 – in TPL:

<p>Used template: <code>{TPL_DEBUG_URL}</code></p>

Explanation: you calculate the URL in PHP (can use an array), then pass it to TPL via $t->assign() – this is the only way to use an array.

CASE 5: WHAT NOT TO DO (ERRORS)

ActionResult
{PHP|cot_tpl_url(['page','list'])}SYNTAX ERROR – TPL parser does not understand square brackets.
{PHP|cot_tpl_url($my_array)}WON'T WORK – TPL has no array variables.
Passing an array inside {PHP|...}ERROR – not allowed.
Using cot_tpl_url() for page linksWRONG – it's the URL to the template file, not the page. Use cot_url() for links.

5. SUMMARY TABLE OF ALL OPTIONS

ContextFirst argument typeSyntaxExample
PHPstringcot_tpl_url('page.list', 'module')$url = cot_tpl_url('page.list');
PHParraycot_tpl_url(['page','list'], 'module')$url = cot_tpl_url(['page','list']);
TPL (direct call)string{PHP|cot_tpl_url('page.list', 'module')}{PHP|cot_tpl_url('page.list')}
TPL (via variable)already a string{MY_URL}{TPL_DEBUG_URL}

6. WHEN TO CHOOSE WHAT – RECOMMENDATIONS

  • Always when the name is dynamic – calculate the URL in PHP (can use an array) and pass it to the template via $t->assign().
  • If the name is static and you need a quick output – you can use a direct call in TPL with a string.
  • Never try to pass an array in TPL – it does not work.
  • For page links – use cot_url(), not cot_tpl_url().

7. FULL REAL-WORLD USAGE EXAMPLE

Task: display debug information on the page about which template is used for the page list.

PHP (controller):

$debug_tpl = cot_tpl_url(['page', 'list'], 'module');
$t->assign('DEBUG_TPL', $debug_tpl);

TPL (template):

<div style="background:#f0f0f0; padding:5px; font-size:12px;">
    Used template: <code>{DEBUG_TPL}</code>
</div>

8. IMPORTANT TAKEAWAYS (REMEMBER ONCE AND FOR ALL)

  1. cot_tpl_url() – is the URL to the template file, not to the page.
  2. In TPL ({PHP|...}) – only strings, arrays are prohibited.
  3. In PHP – you can use both string and array.
  4. Array is just a convenient notation for dynamic names, it is converted to a string with dots.
  5. Always pass the result from PHP to the template via $t->assign() if the name is dynamic.
  6. For page links use cot_url().


Filed under: User Blog
No comments yet
Only registered users can post new comments
webitproff
webitproff
Sodium Carbonate

webitproff

Professional product designer and amateur cyclist living in New York City, USA.