Forums / Developer / sub-content class
Dries Samyn
Wednesday 19 May 2004 7:37:02 am
First of all, sory if this would be covered in the manual somewhere, I haven't been able to find it yet.
When setting up a content class, how is it possible to enable it to have "sub content". For example, when you create a "product", you can then add as mnany "product reviews" as you want. I can't seem to see how that is being enabled.
What I am trying to do is create a content type for a page that allows to have text and any amount of URLs (including title and descrption) at the bottom.
Hope this makes sense.
Thanks,Dries.
Guglielmo Celata
Wednesday 19 May 2004 9:59:50 am
Hi Dries,what I usually do, is to create a new class of content (in your case: <i>product review</i>) and create <i>product reviews</i> as children objects of the <i>product</i> object, using the <i>Create here</i> button in the admin interface.
That is, you don't impose the relation at a design level (i.e. when specifying classes), but at an implementation level (i.e. when creating objects).
It's questionable, but it works.
Remember, though, that you have to enforce a policy, so that the user you choose to authorize, can only create <i>product reviews</i> under a <i>product</i> object and nowhere else (it can be done in the <i>role</i> sub-section of the <i>user</i> section of the admin interface.
Sounds complicated, but it's absolutely not.
Bye,Guglielmo
Thursday 20 May 2004 1:00:49 am
Guglielmo,
Thanks for the reply. I think I understand what you are saying. But how come some content objects (for example the ones of type "product") have a "create here" button, and others don't?I'll explain better. For example, I would like to have subcontent for "article" objects (for a "related links" list for example), but if I create an ojbect of the type "article", I cannot see a "create here" button.
Thanks,
Dries.
Thursday 20 May 2004 3:55:23 am
Well, Dries,the Article class is treated as an exception in the default administration interface. I don't know exactly why (I suppose it's a bug, but you'd better ask somebody in the crew).
You can very easily change this behaviour, anyway, by modifying the following file:
[ezRoot]/design/admin/override/templates/article.tpl
All you have to do is remove the comment around the
<div class="buttonblock">
block where the <i>create here</i> button lies.
Well ... that's what I've done :-)
Guglielmo
Thursday 20 May 2004 4:28:04 am
Thanks for the reply!I suppose I could also add a new custom class based on article.
I'm pretty interested to hear what the reason behind it is though? Can anybody of the "crew" comment on this?
Cheers,