Custom Tags are tags that you can define and use anywhere on your ImpressCMS site. You could see them as extended BBCodes, but multilingual, with group permissions, supporting PHP, and usable in all the ImpressCMS text areas of the type 'AutoFormat', as well as in all templates !
Note : you can define a type of 'PHP' for your custom tag, but that doesn't mean your tag will work in a textarea of the type 'PHP'.
Scroll down this page for an example of Custom Tag usage.
Let's create 2 custom tags with these information: The first one:
The second one:
The Third example:
Then, create a block, visible on home page by every group. Enter this, as the content of the new block:
Let's use a Custom tag below... [customtag]hello[/customtag]
When a user will be looking at your home page, if he is a webmaster, the custom tag will be replaced by:
Let's use a Custom tag below... Hello, you are a Webmaster!
If he is a Registered Users only, then the custom tag will be replaced by:
Let's use a Custom tag below... Hello, you are a Registered user!
And finally, if the user is not loged in (Anonymous) then the custom tag will just be empty, and the user will only see:
Let's use a Custom tag below...
Of course ! In any template of ImpressCMS, simply use this:
<{$icmsCustomtags.hello}>
Everytime you create a custom tag, you can select for which language this custom tag will be used. You can also select All if you want this custom tag to be used by all language.
Yes you can! Simply select PHP as the Type of the custom tag, and, when rendered (providing the user is in one of the group selected in this custom tag, and that the user's selected language is the one linked to this custom tag or the custom tag is to be displayed for All languages), then the PHP code will be executed.
Yes you can! You will need the following code in your PHP page:
$icms_customtag_handler = icms_getModuleHandler("customtag", "system"); $customtags = $icms_customtag_handler->getCustomtagsByName(); if (isset($customtags["tag"])) echo $customtags["tag"]->render();
So, in summary, you can create all the custom tags you need, for any language you want, for any group you want.
When displayed, ImpressCMS will look for the custom tag that matches the user's language and its group permissions! Enjoy !
Last modified on 2012/10/25 by Anonymous
|