Display field attached to custom content-type

Topics: General, Writing themes
May 13, 2014 at 6:19 PM
I am very new to Orchard but I am a developer.

The first page I am trying to create is the home page using some static HTML provided by a third party that has it's own image gallery which I am trying to make dynamic using a field in Orchard. I've added a Layout-url-homepage.cshtml which is getting executed when using my new HomePage content type.

To add the list of images, I used the Amba Image MultiPicker (https://imagemultipicker.codeplex.com/) to add a field to my custom Layout content type for my home page. Now I'm trying to find the field I added by hunting through the Model object passed into the layout but cannot find the field.

I've read other articles/posts that suggest Orchard cannot attach fields directly to content types and implicitly creates a content part behind the scenes. This information didn't seem to help me though.

Does anyone have any thoughts on a) is this approach reasonable and b) how do I find the field? My model type appears to be a Orchard.UI.Zones.ZoneHolding.

May 14, 2014 at 6:46 AM
Have you add a widget in your home page? If so, just click on the specific widget using shape tracing to view your model. Then it should be sth like this: Model.ContentItem.BlogPost.ImageGallery.Images.FilePath
May 14, 2014 at 5:22 PM
Thanks for the reply, I haven't added a widget but that Shape Tracing looks good (first time I've seen it!).

The Model doesn't show much, just Classes, Attributes and Items - but no values.

Should I be using a Widget instead of adding the fields directly to the HomePage Content Type?
May 14, 2014 at 6:02 PM
Probably you need to add the amba content type as a field to page content type.
May 19, 2014 at 5:25 PM
Thanks for the suggestion. Unfortunately I still cannot find the field even on a standard page just with a new Text field so I must be doing something fundamentally wrong.

Are you saying that I should be able to edit the standard "Page" definition, add a text field and then access its value from within Layout.cshtml for the current theme?