Adding two PARTS to a content type

Topics: General
Mar 17, 2014 at 8:08 PM
Edited Mar 17, 2014 at 8:13 PM
I am new to orchard.

My need is to create a content type which will allow introducing three distinct items on a page:

1-some html text
2-an image gallery
3-some html text

I was able to create a new content type containing the first two by adding a BODY part and IMAGE GALLERY part.

How can I add a second BODY part to my content type ? It seems to only allow adding one instance.

Thanks.
Mar 18, 2014 at 11:30 AM
You can't add a part more than once to a content type. But you can add multiple fields of same type. Try text field.


Mar 18, 2014 at 1:34 PM
Thanks for your reply.

The reason I pointed to another BODY part is so that the tinymce html editor can be used in the dashboard. A plain text field is hard to edit and maintain.

Is there any way to allow two tinymce editable fields within the same content type ? If not, do you know of other alternatives to my requirement above ? It seems to be a basic thing for a CMS to handle.
Mar 18, 2014 at 2:13 PM
You can change the field settings (Content Definition -> Edit Your Type, in Fields section, to the left of the added field there is a ">" symbol, which is a link to show field settings) and set the Display Option of the text field to Html flavor to have the editor.


Marked as answer by JSR_TX on 3/18/2014 at 6:49 AM
Mar 18, 2014 at 2:49 PM
Great ! Following your instructions above I added the HTML text field to my content type.

My new text field appears as the first item on the page, followed by the BODY part followed by the IMAGE GALLERY part - Is there a means to position these so I can have the new field coming at the very end ?

Also, the text field title always displays on the page - is there an option to remove it ?
Mar 18, 2014 at 2:58 PM
For positioning, you can use the Edit Placement link in your content type's definition edit page (top right) and drag/drop the parts and fields of the content type to positions you want or use placement.info file in your theme. See http://docs.orchardproject.net/Documentation/Understanding-placement-info for the latter

For field title, I think there is no setting and you need to remove it by overriding the default field template (which renders the field title) with an alternate in your theme. See http://docs.orchardproject.net/Documentation/Alternates for details. Shape Tracing is a tool to easily create alternates, you might want to take a look at it. See http://docs.orchardproject.net/Documentation/Customizing-Orchard-using-Designer-Helper-Tools


Mar 18, 2014 at 4:03 PM
Thanks alot for your anwers and the links included.
I went through most of the docs initially but suffered from information overload.
Now I need to review what you have sent...
Mar 27, 2014 at 5:51 PM
After reading the docs above I was able to obtain the desired results. It may be of use to others so I am resuming the steps:
  • In the dashboard's content definition area, the "Edit Placement" seems to impact only the Dashboard area positioning while creating a new content item. Using drag/drop I placed the Body, ImageGallery, BODY2 (field) in this sequence. This helps in having the parts/fields in the expected order while creating them in the backoffice.
  • To position within the frontoffice I used the theme's placement.info file and added an entry for my new field: <Place Fields_Common_Text-BODY2="Content:7" /> ; This positioned my new BODY2 field where I wanted it (after the image gallery)
  • To remove the field title I activated the Shape Tracing and created the suggested alternate for this field called Fields.Common.Text-BODY2.cshtml ; within this file I removed the title component from the html markup.
The result is exactly what I wanted:
1- a tinymce html area (Body Part)
2- an image gallery (Part)
3- a second tinymce area (BODY2 field)

Thanks to kassobasi for the hints and links.