Content part showing in admin - orchardcms

I have a custom content part, and I added it in a content item. it works fine, but there is a little problem in content items list on admin: the content part is appearing on it.
here is an image of my problem: http://imageshack.us/photo/my-images/163/2b68.png/

In the Placement.info in your module, add the following line:
<Match DisplayType="SummaryAdmin">
<Place Parts_MyPart="-"/>
</Match>

Related

Match tag in placement.info doesn't work in my case

I use Orchard CMS 1.10.1. I have a content type named "Animal" and I have a content Item named "Gold fish". This content item has a MediaLibraryPicker Field.
this field has a "Parts_Common_Metadata_Summary" that shows the create date. what I need is to not display this Create Date.
In Placement.info file of my current theme I added this Code to achieve my goal
<Match ContentType="Animal">
<Place Parts_Common_Metadata_Summary="-"/>
</Match>
This doesn't work but when I put the Place tag without Match tag it works.
My question is what is wrong with my match tag? what is the problem?
ps: ContentType Animal is correct and I also used nested Match tags for Display type Detail and summery also didn't work.
That is because the MediaLibraryPickerField renders another Meta part, specific for the image.
Try this in your placement.info:
<Match ContentType="Animal">
<Place Parts_Image_Metadata="-" />
</Match>

Duplicate an orchard part

I'm trying to use Placement.info instead of overwriting a complete content template and i need to have a part (Parts_Title) displayed in the Content zone and in the Header zone. I was thinking that have two place with that Part in the Placement.info file would do the trick but it seems that the last one wins.
Is there a way to do that? I'm using Orchard 1.9.1.0
Edit 2016-03-16 following Alexander's answer:
There's something i should do wrong; i have a content type designed in the dashboard (no code) named OffreEmploi. I use Content-OffreEmploi.cshtml as the alternate. Here is the code:
#using Orchard.ContentManagement.Utilities;
#Display(Model.Header);
#Display(Model.Content);
#Display(Model.LocalZoneName);
and here is my placement.info
<Match ContentType="OffreEmploi">
<Place Fields_DateTime-DateDebut="Header:2"/>
<Place Fields_Common_Text-Duree="Header:3"/>
<Place Fields_Common_Text-Localisation="Header:4"/>
<Place Fields_Boolean-Temporaire="Header:5"/>
<Place Fields_DateTime-DateExpiration="Header:6"/>
<Place Parts_Common_Metadata="-"/>
<Place Fields_Common_Text-TexteIntroduction="Content:1"/>
<Place Parts_Title="Header:1" />
<Place Parts_Common_Body="Content:3" />
<Place Parts_Title="LocalZoneName:1" />
</Match>
the part Parts_Title is rendered only at the end (in the LocalZoneName)
You can't do this by using only placement.info. The best way for displaying content part twice is to use special local zone for that content part:
Create alternate for Content. Display a zone twice in it alternate by using #Display(Model.LocalZoneName)
Use that local zone in placement.info to render your part inside it Parts_Title="LocalZoneName:1"
Placement.info allows you to specify a single place to put your part in. This is the reason behind the behavior you see - the last entry wins (LocalZoneName:1). And this is where your part's content now resides in - the LocalZoneName.
What Alexander was actually suggesting, and what's the usual solution to this (not unusual) scenario is to use a separate, unique zone to put your part in, and render that zone multiple times, ie.:
#using Orchard.ContentManagement.Utilities;
#Display(Model.LocalZoneName);
#Display(Model.Header);
#Display(Model.LocalZoneName);
#Display(Model.Content);
This will make your LocalZoneName (which now containes the Title part) to be rendered twice - before the Header and Content zones.

Render Orchard Widgets without a page

We would like our Orchard CMS homepage to contain only widgets and no content items. We have two approaches that work:
One. Create a page, title it Home, and set it as the current homepage. Then use placement.info to hide its parts:
<Match Path="/">
<Match ContentType="Page">
<Place Parts_Title="-"/>
<Place Parts_Common_Metadata="-"/>
<Place Parts_Common_Body="-"/>
</Match>
</Match>
This effectively gives us a homepage that displays only widgets. This approach, though, might confuse end users that add content to the site, because they will still see the "Welcome to Orchard!" page and wonder why its content isn't showing up on the site.
Two. Create a new content type called WidgetContainer, that only has the Autoroute part. Then create an instance of it called Home, and set it as the homepage. This is a better approach.
Is there another way to map www.ourdomain.ca to a container that displays only widgets?
Use this module: https://gallery.orchardproject.net/List/Modules/Orchard.Module.Contrib.Widgets
You can create a content type named Widgets Page for instance and add the widgets container part.

Image not appearing from a Content Part with a Media Picker Field

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.
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

Using Orchard CMS, How do I hide items in a container content type?

I have been attempting to hide the contained items of a Page content type. I have been manipulating the placement.info file in my theme but I am not seeing the results I would expect.
Here's my bruit-force attempt:
<Match Path="/about">
<Match ContentType="Page">
<Match DisplayType="Detail">
<Place Parts_Common_ContentItems="-"/>
<Place Parts_Container_Contained="-"/>
<Place Parts_Container_Contained_Summary="-"/>
<Place Parts_Container_List="-"/>
</Match>
</Match>
</Match>
I have scoured StackOverflow for the answer and I have used the Shape Tracing module to give me direction on designing my placement.info file but I still seem to be missing something.
Any pointers are appreciated!
Thanks.
You cannot hide the content of a container using only Placement.info because the list is rendered by its own controller (Orchard.Core.Containers.Controllers.ItemController) instead of using a shape in the standard orchard shape rendering sytem.
However you may use your own (very simple) controller to build a display without this child list.
I'd say don't put it in the container if you don't want it to appear in there. You might also want to check out taxonomies, that provide a much better and flexible approach to classifying your contents.

Resources