Forums / Developer / Some newbie questions

Some newbie questions

Author Message

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

Jan Tuitman

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.

Rainer Krauss

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

eZ debug

Timing: Jan 18 2025 05:15:51
Script start
Timing: Jan 18 2025 05:15:51
Module start 'content'
Timing: Jan 18 2025 05:15:52
Module end 'content'
Timing: Jan 18 2025 05:15:52
Script end

Main resources:

Total runtime0.9357 sec
Peak memory usage4,096.0000 KB
Database Queries197

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0074 589.0391180.8438
Module start 'content' 0.00740.8075 769.8828488.9063
Module end 'content' 0.81490.1207 1,258.7891333.4844
Script end 0.9357  1,592.2734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.3922210.0002
Check MTime0.00140.1537210.0001
Mysql Total
Database connection0.00110.122810.0011
Mysqli_queries0.871793.15541970.0044
Looping result0.00180.18951950.0000
Template Total0.902896.520.4514
Template load0.00210.220220.0010
Template processing0.900796.261720.4504
Template load and register function0.00020.023710.0002
states
state_id_array0.00100.110510.0010
state_identifier_array0.00090.099420.0005
Override
Cache load0.00170.1843260.0001
Sytem overhead
Fetch class attribute can translate value0.00150.160730.0005
Fetch class attribute name0.00120.123640.0003
XML
Image XML parsing0.00050.051130.0002
class_abstraction
Instantiating content class attribute0.00000.001040.0000
General
dbfile0.00150.1604210.0001
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 20
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs