Forums / Developer / Some newbie questions
Jan Tuitman
Monday 03 August 2009 5:47:19 am
Hello,
my name is Jan and I am new to ezpublish. I wondered about 2 things which I cannot find in the documentation.
1. how can you add a custom type of field/attribute to a content type? It is sufficient to store the data in a string but I need a custom gui (both in de admin interface and in the real site) for displaying the edit control.
2. suppose I want to make a blog contenttype and allow comments as children to this content type, but not to other content types. Also I want to give registered users only the permisson to comment.Is there an example available how to do this?
regards,Jan.
Rainer Krauss
Monday 03 August 2009 6:32:29 am
Hello Jan,
1. sounds to me like you want to look under the setup tab in the backend, and edit your class. Usually, for the output or edit of a class the templates available would be enough, but if you want it any modified, you'd have to write override templates that apply specifically to your class.
2. If I remember correctly, eZFlow comes with a blog content type including the ability to add comments. If you want to allow commenting for registered users only, look into the user rights and edit the role of registered users. You can set which modules are available to which roles with what constraints.
Best wishes,Rainer
Monday 03 August 2009 12:54:11 pm
Thanks, Rainer for your response.
For the blog comments I will look into ezflow. For a custom data type, I still wander if there isn't an easier way to do it. I already had discovered the possiblity to override templates based on class name of the node. But I will need to use this data type in a class with many attributes, and also later on in other classes. So it seems strange that I would have to create a class template just for one field... ezpublish must somehow build up the default class html from the html of the attributes that make the class... so isn't it somehow possible to just create templates for a single field?
regards, Jan.
Monday 03 August 2009 1:49:49 pm
Hi Jan,
no, you don't have to create a new class template if you just want to add a new data field to an existing class. (That is, unless you want to have that data field shown in view mode different from the standard template).If I'm getting it right, you just want to add a data field to an existing class? And its an existing datatype? eZ will take care of displaying the appropriate template then in the view and edit modes. Just add your new datafield in the class setup and have a look at it.
Good luck!Rainer