Go to page content


Models for storing and accessing data.

Zotonic provides some models to access the different entities in the system.

Here you can read about the models and how to access model properties or methods from templates. Check the source of the resource modules to learn how to access them from Erlang.

The Erlang modules implementing models always start with “m_” (like in m_rsc). In templates they can be accessed using the “m” accessor, for example:

{# Fetch the title of the page with name page_home #}
{{ m.rsc.page_home.title}}

{# Fetch the title of the page whose id is the integer 1 #}
{{ m.rsc[1].title }}

{# Fetch the title of the page whose id is the template variable id #}
{{ m.rsc[id].title }}

The most important model is m_rsc that implements access to the pages.

Search the documentation

  • m_acl

    Basic access control information.

  • m_category

    Reasoning with the category hierarchy

  • m_config

    System configuration access.

  • m_edge

    Access information about page connections.

  • m_group

    Information about user groups.

  • m_identity

    Usernames and other user identities.

  • m_media

    Model for uploaded files and other media.

  • m_notifier

    Use the zotonic notifier from your templates. [new 0.8-dev]

  • m_predicate

    Information about predicates.

  • m_req

    Access request variables from a template.

  • m_rsc

    Page model.

  • m_search

    Search pages in all kinds of ways.

  • m_site

    Site configuration access.