DEVELOPER GUIDES

Tags

MyCMS have a tag system, inside the themes and the administration panel.

This system is like the tag system in twig template engine.

The tags system is useful for don't write every time something. For example the site url, site name, the theme folder path or what you want.


The structure of a tag:

In MyCMS for identify the tags we use the "{" open bracket, the "@" symbol, the tag, the "@" symbol and the "}" closing bracket.

For example:
{@siteNAME@}, {@siteURL@}...

List of all default tags:

  • {@siteNAME@}: the website name
  • {@my_cms_version@}: the current MyCMS version
  • {@my_php_version@}: the current php version
  • {@siteURL@}: the website url
  • {@siteTEMPLATE@}: the current enabled template
  • {@MY_ADMIN_TEMPLATE_PATH@}: the path to MyAdmin template folder
  • {@siteTIMEZONE@}: the current timezone
  • {@siteLANGUAGE@}: the current language enabled
  • {@siteDESCRIPTION@}: the website description
  • {@templateNAME@}: the template name
  • {@templateVERSION@}: the template version
  • {@templateAUTHOR@}: the template author
  • {@my_cms_welcome_h1@}: The welcome text of MyCMS

User tags:

  • {@user_name@}: the user name
  • {@user_surname@}: the user surname
  • {@user_mail@}: the user email
  • {@user_ip@}: the user ip
  • {@user_rank@}: the user rank
  • {@user_last_access@}: the user last access

How to add tags

You can also add custom tags in your theme, open the functions.php file and add this.

"$this->container['theme']->add_tag('tag_name', 'tag_value');" without ",
replace "tag_name" with the tag name like "siteNAME", and replace "tag_value" with the value.

For example I've added this custom tag:
"$this->container['theme']->add_tag('helloTag', 'Hello, I\'m a custom tag!');"
{@helloTag@} => {@helloTag@}

How I can write tags in my theme?

If you need to write a tag without it becoming replaced with its value, you need write before the tag this: "no_".

For example: if you write {@no_helloTag@} become {@helloTag@}.

-For write {@no_helloTag@} I've add a custom tag.

Twig tags support

Every MyCMS tag is a twig variable. Twig variables