Token management

As usually let's start with an example. Let's say you have styled your article with the attributes you wanted. Everything is perfect, but you want to style other parts of your site, too.

What if you want to add information on your blog layout, saying that every article is a independent element, with its category, its creation time and so? Using the JCE editor plugin you can't, since your scope is limited to the article; you need another tool.

The logic

To simplify things, we have introduced a search&replace token system. What does it mean?

Well, it's quite simple: you create a token and assign him a value (it could whatever you want), then you add these tokens to your site: you can add them inside your articles, inside your template, on your template overrides... wherever you want.

Next, our system plugin will replace the token string with the value you just typed.

For example, you can create a token named ARTICLE_WRAPPER and replace it with

itemscope itemtype="http://schema.org/WebPage"

Your starting text is something like that:

        
<div { ARTICLE_WRAPPER } class="item-page<?php echo $this->pageclass_sfx?>">
...
...
</div>
        

But the final output (read from search engine) would be:

        
<div itemscope itemtype="http://schema.org/WebPage" 
     class="item-page<?php echo $this->pageclass_sfx?>">
...
...
</div>
        

This example is taken from the default layout of Article view of the com_content component and it's inside the installation package.

Let's see how to add and manage more token.