Introduction to Tags

What are tags ?Top of Page

Ionize tags are XML entities, used in the views of the website to display data.

One tag always start with the <ion: prefix.

Each tag has a corresponding PHP method which retrieves data from database.

Tags can be nested and often, they retrieve data regarding to their direct parent.
We call that the "context" of the tag.

Context are processed from left to right.
For example <ion:page:articles:article:title /> will get first the current page data, then the articles, then loop through each article and finaly get the title.

One tag has a name and can have some attributes, which help to return the good data.

One tag can simply return data or it can be one "Iteration" tag, used to loop through an collection of elements, like articles or media.

For example, if you want to display all the articles of a page, you will need to loop through articles. The <ion:articles /> tag will do this.

Example of one simple data tag

In this example :

  • <ion:page : means "I want data from the current page"
  • <ion:page:title /> means : "Display the title from the current page"
  • tag="h2" is one tag attribute (named "tag") with the value "h2". That means "Wrap the title into one H2 HTML tag"
<!-- Displays the title of the page : short write mode -->
<ion:page:title tag="h2">

<!-- Same result, long write mode -->
<ion:title tag="h2" />

Example of one iteration tag

In this example, we wil iterate through all languages with the tag <ion:languages /> and display each language name and URL.

<ion:languages tag="ul" id="lang" class="languages">

    <!-- Displays the language name and links to the current content for each language -->
    <li><ion:language:url /><ion:language:name /></li>


Ionize default tagsTop of Page

Ionize comes with several tags, which can be grouped in families :

  • Website tags : Data concerning the website : title, meta, URLs, settings, etc.
  • Navigation tags : Navigation through pages
  • Languages Tags : Navigation through languages
  • Page tags : Data from pages
  • Article tags : Data from articles
  • User tags : Data from user
  • Media tags : Data from media
  • Form tags : Display and process forms