HyperFluxCMS

Fast. Flexible. Free.

HyperFluxCMS

Variables and parameters

Understand and use variables and parameters

published 01/01/2025 15:29, updated 04/13/2026 22:37

Posts and templates which you edit in HyperFluxCMS can use a powerful feature called Variables, which make the site more dynamic. Understand what they are for and how to use them.

HyperFluxCMS has an interesting feature called VARIABLES.

Variables are pieces of information that can be included in pages and can vary according to conditions and are replaced by the appropriate content when the page is visited.

In HyperFluxCMS, a variable is marked by an at sign "@"; the type ("R" or "r") for Runtime variables; "C" or "c" for Compile-time variables; a colon (":"); and the variable name. All without spaces or line breaks. This entire block will be replaced by the variable's value.

There is also a third type called Parameter. A parameter is passed by a page or a Template when it calls a Template. A Parameter is marked by an at sign "@"; the type ("P" or "p"); a colon (":"); and the parameter name. All without spaces or line breaks. This entire block will be replaced by the parameter's value.

Examples:

@c:page.title is replaced by the page title at the moment the post is created or edited.
@r:author.name is replaced by the post author's name at the moment it is accessed.
@p:page.content is replaced by the value passed as a parameter called "page.content".

A variable or parameter can be used anywhere in a post or template, whether using HTML, HyperCode or HyperLite. Except in raw text snippets (delimited by <<< >>>) and raw HTML snippets (delimited by << >>).

An example of a variable is the value page.authorname. If you include in the post the text @c:page.authorname, the text will be replaced by the name of the user who created the post.

Example in HTML:

<p>Written by @c:page.authorname </p>

Displays:

Written by John Doe

HyperFluxCMS variables can even be used in small snippets of Javascript embedded in the post or templates, usually to initialize Javascript variables that can be used by more complex functions and scripts.

For example, you can insert the text below into the post. After it is loaded, the page will have a global variable in memory called title that will contain the post title and can be used by functions in javascript.

<script>
var title="@c:page.title"
</script>

Compile-time Variables

There are two types of variables: Runtime and Compile-time.

Compile-time variables are replaced by their respective values at the moment the page or template is saved and compiled. Only information that is available at the time of saving and compilation can be used as Compile-time variables.

To use a Compile-time variable, the variable name must be provided after @C: or @c:

Example:

@c:page.title

inserts the current value configured as the Page Title, as it was at the moment the page was saved and compiled.

Runtime Variables

Runtime variables are replaced by their respective values only when the page is accessed by the site visitor.

To use a Runtime variable, the variable name must be provided after @R: or @r:

Example:

@r:author.name

inserts the current value configured as the Page Author's name, as it was at the moment the page was accessed.

Which one to use?

Compile-time variables @c:xxxx are more efficient and use fewer server resources. But they should only be used for values that are known and fixed at the moment the page is saved.

An example is @c:page.title, because even if the author or editor changes the page name in its properties, the code will be recompiled upon saving, and @c:page.title will remain consistent.

Runtime variables @r:xxxx require a bit more server resources. But they should be used to insert values that may vary independently of the page content.

An example is @r:site.name, which returns the site name, because it is possible that, after the post was created, someone modifies the Site Name on the Site Properties page; and if a post page used this variable as if it were a compile-time variable like @c:site.name, the code would be compiled fixing the value of that property at compilation time and would be outdated when the page is accessed.

Using @r:site.name ensures that the value used will be the current value at the moment the page is accessed.

To see the list of variables supported in the current version of HyperFluxCMS, see the Variables Reference Guide.

Parameters

Parameters are replaced by their respective values only when the page is accessed by the site visitor.

Parameters are used exclusively within templates. The values are provided by pages or other templates that call the templates.

For example, when including the following call, the template called "pop-up" is loaded and the parameter "img" is set to "/image1.jpg" and the parameter "text" is set to "Lorem Ipsum".

[template name="pop-up" img="/image1.jpg" text="Lorem Ipsum"]

Inside the "pop-up" Template code, you can access the values passed as parameters and use them in text, HTML elements, javascript, etc.

<p>Sponsored: @p:text </p> (@p:text will be replaced by "Lorem Ipsum")
<img src="@p:img"/> (@p:img will be replaced by "image1.jpg")