Content Type

Topics: General, Installing Orchard
Dec 1, 2011 at 10:13 PM

Hi

I have a need to create a number of pages of a similar format to be used by classes in a school. They will all need a text area, an image gallery and a blog. I've created image galleries and blogs for each page. I think I need to create a custom content type to be the basis for each page, but on doing so, I can have the text area and the image gallery, but not the blog.

I also created a layer to see if that would work, but the extra widgets for the image gallery and blog are common to each of the pages.

I have a way forward, where I create layers for each class page to manage this, but it seems far from ideal.

Ideally, I need the ability to create a new content type which can take the text area, image gallery and blog. How can I add a blog to a custom content type?

Thanks

Graham Cottle

Coordinator
Dec 1, 2011 at 10:17 PM
Edited Dec 1, 2011 at 10:17 PM

Modify the existing blog type maybe.

Dec 1, 2011 at 10:24 PM

Is it possible to take a copy of the blog type and modify that?

What is the reasoning behind not allowing a blog part to be added to a content type?

Coordinator
Dec 1, 2011 at 10:27 PM

The blog module was written a very long time ago (before our type system was fully baked) and has a few things hard-coded that shouldn't be. This being said, creating a type that behaves pretty much like a blog but isn't one should be fairly easy.

Dec 1, 2011 at 10:33 PM

Thanks for this. I will create some lists instead of blogs and use them instead on the page. I did see that I could get that to work, but didn't build on it.

Thanks

 

 

Dec 1, 2011 at 11:05 PM

Since most of the hard-coding is route related, this is yet another thing that will look different with Autoroute.

Dec 3, 2011 at 11:39 AM

Hi,

So I have now built a Content Type, which has the following:

  • ​Common
  • Body
  • Container
  • Image Gallery
  • Menu Relation
  • Publish Later
  • Route

This gives me what I want in terms of the content of the page and I know that I can style it well enough.

What I want now is to have a title for the List and the Image Gallery and for the Image Gallery to show above the list. I have played with the Placement.Info file in my theme and this doesn't seem to make any difference.

Using the ShapeTracing, I indentified some of the part names:

  • Parts_Common_Body
  • List
  • ImageGallery

In my Placement.info, I have tried:

<Match ContentType="ClassPage">
<Match DisplayType="Content">
    <Place Parts_ImageGallery="List:before"/>
</Match>
</Match>

This had no effect.

I also tried

<Match ContentType="ClassPage">
<Match DisplayType="Content">
    <Place Parts_ImageGallery="Content:after"/>
</Match>
</Match>
No effect

Then

<Match ContentType="ClassPage">
<Match DisplayType="Content">
<Place Parts_ImageGallery="Content:before"/>
</Match>
</Match>
This got the server in a loop and the page never rendered.


So now I am stuck. I tried looking at the Model and can see how that is put together, with @Model.ContentItem.Parts. I can see that Parts[2][3][4] are the ones I am interested in and want to arrange them as [2][4][3], but I can't get to an "alternate" to change this, as the alternates all offer @Display(Mode.Content) and it doesn't seem to be possible to drill into this.

Once I have got the placement sorted out, how do I get the titles above the List and Image Gallery? Neither seem to offer it. I could add fields and this would enable the text entry, but then there is the difficulty in getting them in the right order.

Thanks

Graham

 
Dec 3, 2011 at 12:01 PM

 

<Match DisplayType="Content"> , i never saw this, only this 3  Detail,Summary,SummaryAdmin.

any more?

Dec 3, 2011 at 12:08 PM

I was guessing on the content type. Having said that, changing to either Detail or Summary made no difference.

Dec 3, 2011 at 9:16 PM

You can in fact render content items with any DisplayType you wish to; but in core it's only Detail, Summary and SummaryAdmin. So the various match clauses you tried will all match nothing. ContentType has a hidden feature that it will also match the stereotype; this is either Content or Widget. So if you've ever seen Content used anywhere else in placement it was probably in ContentType, not DisplayType.

If you want to create your own custom DisplayTypes (e.g. you might want a variety of different layouts for content) you can call IContentManager.BuildDisplay(content,displayType). Also my Mechanics module lets you play with DisplayTypes somewhat when displaying items in different types of relationship.