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.
Related
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>
I have a custom ContentPart as well as an editor view under Views/EditorTemplates/Parts/ folder. I am trying to figure out the appropriate DisplayType value to use in my placement.info file to get this view to kick in. I see it show up if I use something like this:
<Match ContentType="MyType">
<Place Parts_MyPart_Edit="Content"/>
</Match>
But I'd like to be able to target it a little more explicitly like:
<Match ContentType="MyType">
<Match DisplayType="????">-->
<Place Parts_MyPart_Edit="Content"/>
</Match>
</Match>
I have tried "Detail", "Summary", and "SummaryAdmin" unsuccessfully.
So 2 questions:
Is there a standard list of "DisplayType" values documented somewhere?
Is there a way to discover what the "DisplayType" is at runtime via a breakpoint or otherwise so that I can further restrict it in the placement.info?
Edit
Thinking about this a bit more, is 'DisplayType' even involved when Editor templates are used? I just realized that Parts_MyPart_Edit may be restrictive enough since it is already targetting _Edit. Is this right, or is there also an option to match on 'DisplayType' that can be used for editor templates?
1: Don't know exactly where the correct documentation is on this topic, but this is the correct syntax:
<Match DisplayType="Summary"> Detail and SummaryAdmin are also valid display types.
Besides that, you can also define your own display type:
var shape = _contentManager.BuildDisplay(item, "CustomDisplayType");
Then your shapes/views must be named as YourShape.CustomDisplayType.cshtml.
Then you can use your displaytype in placement.info:
<Match DisplayType="CustomDisplayType">
<Place Parts_YourPart="Content:1" />
</Match>
2: Use the 'shape tracer' module. When enabled you can find in the front-end which display type is used.
You probably made a mistake with either the <Place Parts_ section or your part driver is not correctly implemented. Also check if your shape's name is correct.
Posting this as an answer, since I don't have a high enough reputation to add comment yet :)
If you are interested in using Shape Tracer on admin pages, open up the ShapeTracingFactory.cs file in Orchard.DesignerTools module, and comment out the following line in the IsActivable method:
if (AdminFilter.IsApplied(new RequestContext(_workContext.HttpContext, new RouteData())))
return false;
I have found this extremely useful for figuring out exactly what is happening during Content Authoring tasks
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.
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>
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.