# Global template variables

Source: https://zotonic.com/reference/template-variables

URI: https://zotonic.com/id/1840

Language: en



<div>
            
  <div class="section">

<p>These variables are always available for
<a class="reference internal" href="/id/doc_developerguide_templates#template-variables"><span class="std std-ref">rendering in templates</span></a>.</p>
<div class="section">
<h2>zotonic_version</h2>
<p>The version of Zotonic, for example <code class="docutils literal notranslate"><span class="pre">"1.0-dev"</span></code>.</p>
</div>
<div class="section">
<h2>zotonic_dispatch</h2>
<p>An atom with the name of the dispatch rule that was applied to render the current page.</p>
</div>
<div class="section">
<h2>zotonic_dispatch_path</h2>
<p>A list containing the request path used as initial input for the dispatcher.
The path is split on <code class="docutils literal notranslate"><span class="pre">/</span></code> and after an optional rewrite. This means that the
list doesn’t contain the language prefix. For example, the path
<code class="docutils literal notranslate"><span class="pre">/en/foo/bar?a=b</span></code> will give the list <code class="docutils literal notranslate"><span class="pre">[&lt;&lt;"foo"&gt;&gt;,</span> <span class="pre">&lt;&lt;"bar"&gt;&gt;]</span></code>.</p>
</div>
<div class="section">
<h2>zotonic_dispatch_path_rewrite</h2>
<p>Same as zotonic_dispatch_path, but set to the path after an optional internal
request rewrite inside the dispatcher. For example if a resource has its
<cite>page_path</cite> set to <code class="docutils literal notranslate"><span class="pre">/foo</span></code> and the requested path is <code class="docutils literal notranslate"><span class="pre">/en/foo</span></code> then the
<code class="docutils literal notranslate"><span class="pre">zotonic_dispatch_path</span></code> will be set to <code class="docutils literal notranslate"><span class="pre">[&lt;&lt;"foo"&gt;&gt;]</span></code> and the
<code class="docutils literal notranslate"><span class="pre">zotonic_dispatch_path_rewrite</span></code> could be set to something like
<code class="docutils literal notranslate"><span class="pre">[&lt;&lt;"page"&gt;&gt;,</span> <span class="pre">&lt;&lt;"1234"&gt;&gt;,</span> <span class="pre">&lt;&lt;"foo-slug"&gt;&gt;]</span></code>.</p>
</div>
<div class="section">
<h2>z_language</h2>
<p>The currently selected language. This an atom, for example: <code class="docutils literal notranslate"><span class="pre">en</span></code>.</p>
</div>
<div class="section">
<h2>q</h2>
<p>A key/value list containing the current request’s query variables. For GET requests, these are the arguments passed from the query string (e.g. <code class="docutils literal notranslate"><span class="pre">?foo=bar</span></code>); for POST requests, these are also the values posted in the POST form. For more access to the raw request data, look at the <a class="reference internal" href="/id/doc_model_model_req"><span class="std std-ref">m_req</span></a> model.</p>
</div>
<div class="section">
<h2>now</h2>
<p>The UTC date and time in Erlang tuple notation, for instance <code class="docutils literal notranslate"><span class="pre">{{2014,4,17},{13,50,2}}</span></code>.</p>
</div>
<div class="section">
<h2>m</h2>
<p><code class="docutils literal notranslate"><span class="pre">m</span></code> is not really a value, but it’s an indicator to trigger a lookup in one of Zotonic’s <a class="reference internal" href="/id/model#models"><span class="std std-ref">Models</span></a>. For instance the <a class="reference internal" href="/id/doc_model_model_rsc"><span class="std std-ref">m_rsc</span></a> model is always exposed and can be used like this <code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">m.rsc[123].title</span> <span class="pre">}}</span></code>.</p>
</div>
<div class="section">
<h2>true, false, and undefined</h2>
<p>The values <code class="docutils literal notranslate"><span class="pre">true</span></code>, <code class="docutils literal notranslate"><span class="pre">false</span></code> and <code class="docutils literal notranslate"><span class="pre">undefined</span></code> are predefined.</p>
</div>
</div>


           </div>

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1840?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1840?language=en>)
