This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » Online Editor - Css Class for XML-Block

Online Editor - Css Class for XML-Block

Online Editor - Css Class for XML-Block

Wednesday 07 March 2012 7:34:55 pm - 5 replies


is it possible to add a CSS Class to the entire XML Block?

What i'm trying to achive is something like this:

<div class="my_custom_class">

  Content of the XML Block


Thanks in advance


Thursday 08 March 2012 7:19:03 am

Hello Christoph,


I suggest either a template override or a custom tag might help you reach your goal.

I hope this helps ...



Modified on Saturday 10 March 2012 2:52:55 am by // Heath

Thursday 08 March 2012 2:46:03 pm

Hello Christoph,

If you want like a div, you need a customtag. Create a content.ini.append.php in your extension with


for a better usability add ezoe_attributes.ini.append.php - it make a selectionbox for your customtag.

Name=LayoutTitle=Bitte wähle das Layout
Selection[empty]=Please select your class...
Selection[my_custom_class]=great Class

next step you need a template for the output. create under /templates/content/datatype/view/ezxmltags/ myownbox.tpl

 <div {if ne($class,'empty')}class="{$class}"{/if}>{$content}</div>


Well, but if you prefer to add a class in a existing tag: example "paragraph"
Just add in your content.ini.append.php

ClassDescription[my_custom_class]=Add our great class to the paragraph 

I hope this works happy.gif Emoticon 

Thursday 08 March 2012 3:57:22 pm

Heath, David,

thanks for your answers. I created a custum class for the paragraph tag, disabled the online editor and wrapped <paragraph class="my_custom_class"></paragraph> around the existing content, that worked. Somehow i wasn't able to do that in the Editor.

David's solution looks good, i'll give it a try in the future.



Saturday 10 March 2012 3:32:34 am

Hello Christoph,


Remember that by default when you use an xml block (ezxmltext datatype) attribute in a content object, you have to think in a slightly different perspective.
An xml block stores ezxml not html or xhtml. This means that without the online editor (ezoe) the input requires valid ezxml which provides much different set of 'tags' which you can use (See above link to docs).
Remember in this perspective content and design are much more separated than you have come to expect from plain old html so you may find you need to use custom tags and different decisions when it comes to what content and markup you can enter here as valid input.


Next when you do have ezoe installed and available (the default), you quickly find that ezoe transforms ezxml into html for use within ezoe (ezoe+tinymce) where rendered to the browser and back to ezxml when storing input / content.


Someone mentioned an interesting thing to think about once in passing, when using ezxmltext, where in html you would use <br /> (possibly incorrectly) in ezxml you would prolly use a custom tag (with content / other markup contained within).

I'm prolly not doing justice to the idea but I got the idea instead of one tag you would wrap the content in question say above within a custom tag. This may still have limitations in practice.


I hope this helps ...



Saturday 10 March 2012 3:53:29 am


Checkout the plain text datatype, modified copies
 and template overrides as a basis of alternatives
you can build outside the perspective described

You would not believe how many people live outside
 those rules all the way to custom editors and beyond.
Custom datatypes are kinda cool like that. Still, security
conscious stay weary, it prolly is not what you'd expect.


* This post's theme song: Eminem - Without me (Radio Edit ***)
** Mirror:


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from