Project: xajax classAttributes

Next article


The Xajax ClassAttributes extension allows you to add class attributes to a content class or reorder class attributes without the need of a page refresh. It is especially useful when editing large content classes.


the xajax eZ publish extension is copyright © 2005-2006 SCK•CEN and is distributed under the GNU GPL.

It was written by Kristof Coomans.


The extension adds a second button "Add attribute with Ajax" to the class/edit view, at the right of the "Add attribute" button. Click on the "Add attribute with Ajax" button to add a new class attribute of the selected datatype.

There's also a second row of "up" and "down" buttons for each class attribute. Use these buttons to reorder class attributes by using Ajax.


A live demo will be available soon.




Needed extensions

xajax_classattributes depends on the following other extensions:

Supported user agents

The requirements of the xajax extension also apply to xajax_classattributes, so you'll need a user agent that is supported by the xajax library:


Before installing xajax_classattributes, please install all other required extensions like xajax.

A warning on settings installation

Missing xajax settings installation

If you get the following javascript error, ' Error: xajax_moveClassAttribute is not defined'.

You very well may have ignored the following settings installation warning when installing the xajax extension.

Design extension settings conflicts

If you get the following javascript error, ' Error: toggleEvenRows is not defined'.

You very well may have another design extension (prioritied above the xajax_classattributes extension) with a design.ini.append.php settings file which resets the JavaScriptList[] array.


You can download xajax_classattributes from it's contribution page at or you can check it out right from the community subversion repository at pubsvn.

Install the extension

Follow the steps described in the eZ publish technical manual to extract and activate the extension.

Clear caches

Clear the INI and template caches.

Technical notes

Replaced templates

To integrate well into the admin interface, this extension replaces the following templates :

  • design/admin/templates/class/edit.tpl
  • design/standard/templates/class/datatypes.tpl

Provided xajax functions

The xajax_classattributes extension provides the following xajax functions:

  • addClassAttribute( $classID, $datatypeString )
  • moveClassAttribute( $attributeID, $direction )

A warning regarding custom datatypes

The xajax_classattributes extension has a documented problem with custom datatype extensions which do not follow clean code best practices.

On 2007.07.28 a developer was trying to use the smilefckeditor (last updated in 2006 and no longer maintained) and when one tried to use the smilefckeditor and xajax_classattributes at the same time when trying to add an ezhtml datatype (provided by the smilefckeditor extension) the xajax_classattributes would stall out and fail to function properly.

Apparently it had to do with the line breaks after the PHP closing tag inside 'extension/smilefckeditor/autoloads/eztemplateautoload.php'. The resolution was found to remove everything after the PHP closing tag in the above file and the two extensions would function properly together.
We thought this is definitely something to put in the troubleshooting section of the xajax_classattributes extension documentation. If you have futher problems be certain to document and report them!


If you'd like to contribute to this extension, either with a new idea or your own code, then contact Kristof Coomans.