Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

Custom tags

In addition to the default tags described above, the "XML block" datatype makes it possible to use custom tags. A custom tag can be used both as a block or an inline element. Custom tags must be specified using the "AvailableCustomTags[]" array in the [CustomTagSettings] block within an override for the "content.ini" configuration file. When the XML is rendered, the contents of a custom tag will be replaced by a custom template. The name of the template must be specified using the "name" parameter. Example of usage:

<custom name="template_name" [custom_parameter="value" [...] ]>
The quick brown fox jumps over the lazy dog.

The custom tag in the example above will be replaced by a template called "template_name.tpl". This template must be located in the following directory within the current design: "/templates/content/datatype/view/ezxmltags/" (or one of the fallback designs). It is also possible to create an override template. The contents of the tag will be available in the "$content" variable within the inserted template.

The custom parameters are optional. Their names must be specified using the "CustomAttributes[]" array within an override for the "content.ini" configuration file. When used, a custom parameter will be available as a template variable with the same name as it was specified in the tag itself.

Balazs Halasy (10/03/2005 11:49 am)

Svitlana Shatokhina (19/07/2007 10:16 am)

Balazs Halasy, Svitlana Shatokhina


  • Custom Tags / Online Editor

    I have tried the example above and everything works great.

    But when I use the custom tags inside the Online Editor there only appear a button with a question mark. I would like to display the custom tag like it is done for the factbox tag.

    Here the code from my content.ini file:


    And here the code from mytag.tpl

    <div align="center">
    <table bgcolor="#eeeeee">

    Any ideas?
  • custom tags have to also exist in admin siteaccess

    It is also necessary to add any custom tags to the admin interface's content.ini.append.php - otherwise when you try to put the custom tag in an xml block ez rejects it as being unknown.
  • How to make custom tags (classes) visible in the online editor

    I have e.g. made a blue table as a custom tag class and inserted it in into content.ini (and of course defines the look in the css): The content.ini looks like this:



    This works fine in the public pages, but the color of the table is not visible in the editor. I have tried to copy everything into both the content.ini both in /admin, our local admin, and into the content.ini for the editor in /var/www/ezpublish/extension/ezdhtml/settings, but to no effect. I have also adden the line
    IsInline[tableBeige]=true but this also has no effect.

    In the editor the table is still without color. Any suggestions ?
    • Re: How to make custom tags (classes) visible in the online editor

      It seems the basic question is where and how to insert the reference to the css. The obvious would seem to be to insert the refenece into the template controlling the editor/xml field, i.e. /var/www/ezpublish/extension/ezdhtml/design/standard/templates/content/datatype/edit/ezxmltext_ezdhtml.tpl, but this has no effect. I have also tried inserting it into the edit.tpl, but also with no effect. The trick maybe has something to do with how the reference to the iframe og the editor field is made in the css ?
  • Content.ini - location ?

    Where should the content.ini file be placed:
    * in your own admin
    * in the (ez) admin
    * in /settings/override/

    And what about the content.ini in the editor extention in /var/www/ezpublish/extension/ezdhtml/settings

    How many content.ini are actually needed and which should be edited to make things work
  • CSS classes names

    Stop giving example like p.pRed {background-color: red;} or tableBeige. This is not CSS! CSS aim to separate content and display. And a class name is in the XML so it's content and not display. You use pRed to highlight things, red fits in your actual design, seems perfect. Now time run, taste changes, your design have to be updated, and red sux. What do you do? Run a script on all your content to replace pRed with pViolet?

    Name your class with a content point of view. A class name like "highlight" doesn't bore when updating or changing design. CSS classes are done fore re-use. So a p.pHighlight is a bad habit too. p.highlight already aim <p> and div.highlight, span.highlight can share common attributes under .highlight. This is the beginning of cascading. Cascade are maybe done to decrease the quantity of class names and rationalize. Don't do things like span.infos_highlight, span.article_highlight when you have context. #infos .highlight, .article .highlight for example. Prefere cascading to new classes. It's like increasing the usage of the fallback between templates in eZ to decrease the number of templates...

    From my point-of-view, the "tableBeige" comment is a evidence that we must stop giving bad habit and start to struggle for the good ones :)
    • Re: CSS classes names

      Hi Adrien!
      Please, use http://ez.no/developer/forum for CSS class names discussion. Thank you.
  • How to turn off adding paragraph to content of custom tag?

    And I don't want it to be inline cause editing it is less convenient in OE.