Image not appearing from a Content Part with a Med

2019-08-05 08:47发布

问题:

I am trying to achieve the carousel and have got so far except not being able to show the image. The sample can be found here http://www.stevetaylor.me.uk/image-carousel-using-twitter-bootstrap-and-orchard-cms-projections.

To replicate do the following:

1.Create a new content type a. Creatable b. Add Fields i. Field Name: Image; Type: Media Picker; ii. Field Name: Priority ; Numeric Field

2.Go to Admin>>Content. I would expect to see both the Image Url and Priority Value. However only see the Priority Value.

3.Create a project of the content type and list them on the home page using the default layout and same occurs only the Priority field is showing but no image.

I am running a fresh install of 1.6.1 with no extra modules.

回答1:

The media picker field is not displayed in the Summary view by default. See this response to a similar question:

How to add Image Field to Blog Post Summary in Orchard CMS?

In short you need to add the following to your placement.info file:

<Match DisplayType="Summary">
  <Place Fields_MediaPicker="Content:1"/>
</Match>

...and to display in admin list, include in the admin theme placement file:

<Match DisplayType="SummaryAdmin">
  <Place Fields_MediaPicker="Content:1"/>
</Match>

Orchard's docs on placement: http://docs.orchardproject.net/Documentation/Understanding-placement-info