cre8magic – Magic Tokens
Most settings will be parsed through a tokens-engine which will convert all kinds of tokens such as
[Page.Id] into their respective value.
Note that each context is different.
For example, when parsing settings at the page level,
[Page...] tokens will work, but
[Module...] tokens will not work.
Note: The list of tokens is still work in progress
Purpose of cre8magic Tokens
The purpose of these tokens is for use in configurable values - such as classes on HTML tags.
They are currently not going to give you all possible values, for eg. there is no
since there is no good reason to use this in such scenarios.
If you need those values in your HTML (eg. to create special hover-labels) you would just do that in Razor code.
Site tokens work everythere. As of now we have these site tokens:
[Site.Id]- ID of the current site
Assets tokens work everywhere. As of now we have these assets tokens:
[Theme.Url]- the url like
Themes/your-theme-namefor where your files should be note: it doesn’t have leading or trailing slash, so you would use
[Theme.Path]/Assets/logo.svgnote: it also doesn’t have
wwwrootas that is never in the public URL
Page tokens work everywhere. They are especially useful in creating menus. As of now we have these page tokens:
[Page.Id]- ID of the current page
[Page.ParentId]- ID of the pages parent page or
[Page.RootId]- ID of the root page in the tree leading to this page or
Module Tokens work on Containers only. As of now we have these module tokens:
[Module.Id]- ID of the current module
Module Type Information
[Module.Namespace]- the name like
Oqtane.Modules.HtmlTextof the current module ideal to add to containers where you wish to have special styling for special types of modules this uses the namespace, without the final control name
[Module.Control]- the control name like
Indexof the current module ideal to specify even more specific styling from the namespace the final control name
[Module.Name]~ - the name like
HtmlTextof the current module (from the namespace, without the final control name) impossible to implement because each module will have different namespace conventions, so finding the real name isn’t possible
Menu Tokens work on Menus only. As of now we have these menu tokens:
[Menu.Id]- ID of the menu which is normally randomly generated to ensure that each menu is unique for collapse/uncollapse
[Menu.Level]- level of the menu which can be different for the page level, as menus that start at level 2 still have the first items on menu level 1
How it Works
As of v0.1 2022-Q3 it’s still a simple search-and-replace. We plan to use a more powerfull RegEx in the near future.