orchardcms

What is the proper way to add a Field to a custom Part in code?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 07:38:54
There are several similar questions that sort of deal with this issue like this one or this one offering a pretty hacky solution . None of the ones out there have a clear satisfactory answer, or an answer at all, or are asking quite the same thing to begin with. Record public class MyPartRecord : ContentPartRecord { public virtual Boolean Property1 { get; set; } public virtual string Property2 { get; set; } } Part public class MyPart : ContentPart<MyPartRecord> { public Boolean Property1 { get { return Record.Property1; } set { Record.Property1 = value; } } public string... } Migration

Generating Shapes with ShapeHelper in Orchard CMS - Type Not Found

送分小仙女□ 提交于 2019-12-06 07:26:16
I'm building a site using Orchard CMS and creating my own custom modules. I have been following a couple of tutorials and so-far-so-good. I don't understand how the .ShapeHelper() method works and it's giving me a little trouble. The following code, from my Driver file, works perfectly fine and generates my view on the front-end. protected override DriverResult Display(SubscribersFormPart part, string displayType, dynamic shapeHelper) { // setup model part.DateStamp = System.DateTime.Now; return ContentShape("Parts_SubscribersForm", () => shapeHelper.DisplayTemplate(TemplateName: "Parts

Join Non ContentPart Table to ContentPart Table Using Orchard HQL API

大城市里の小女人 提交于 2019-12-06 06:31:17
问题 I am trying to perform a simple join between two different tables using the Orchard HQL API. The problem is that one of the tables is not a ContentPartTable. Is this possible?? Here is what it would look like in regular SQL: Select * From ItemPartRecord Join ItemRecord On ItemRecord.ItemId = ItemPartRecord.ItemId Where ItemRecord.Price Between 1000 and 10000 How exactly could I go about doing this? 回答1: If anyone is wondering how to do this: //Join the non content part table var

Orchard 1.5 add class or ID in ContentMenuItem

喜欢而已 提交于 2019-12-06 06:30:07
问题 How can I add a class and/or ID to be output for a Content Menu Item with Orchard 1.5? 回答1: Go to Content/Content Parts, edit the Menu content part and add a "CssClass" text field. Then, override the template for menuitem.cshtml and right after the var tag = line, add: if (Model.CssClass != null) { tag.AddCssClass(Model.ContentItem.Menu.CssClass.Value); } That should do the trick. 来源: https://stackoverflow.com/questions/12109728/orchard-1-5-add-class-or-id-in-contentmenuitem

Have two field with the same type in one page with arbitrary place.

本秂侑毒 提交于 2019-12-06 06:25:56
I created the CategoryPart and I added two text field to it. I want to add some custom data in the page between two text fields data. The problem is when I want to specify the place of the text field in Placement.info I just have one Shap "Fields_Common_Text" for all the text fields in the page so I can't specify different places for different fields with the same type. Is there any way to do it in Orchard? Thanks in advance. my Placement.info is like this: <Placement> <Match DisplayType ="Detail"> <Place Parts_Category="Content:9"></Place> <Place Fields_Common_Text="Content:10"></Place> <

Custom View For RecentBlogPosts in Orchard

孤街浪徒 提交于 2019-12-06 05:16:00
I've been searching and trying for 2 days to change the view for the RecentBlogPosts content type that appears on my homepage. I want to display the title and a phrase from the posts. I have managed to find a view that shows the title for each post, but I haven't managed to figure out what the other parts in the Model are named or how to extract the text. Help will be GREATLY appreciated ! @using Orchard.ContentManagement; @using Orchard.Core.Routable.Models; @using Contrib.Hyperlink.Fields; @{ IEnumerable<object> blogPosts = Model.ContentItems.ContentItems; } @if (blogPosts == null ||

Understanding Orchard Joins and Data Relations

北城以北 提交于 2019-12-06 04:20:28
问题 In Orchard, how is a module developer able to learn how "joins" work, particularly when joining to core parts and records? One of the better helps I've seen was in Orchard documentation, but none of those examples show how to form relations with existing or core parts. As an example of something I'm looking for, here is a snippet of module service code taken from a working example: _contentManager .Query<TaxonomyPart>() .Join<RoutePartRecord>() .Where(r => r.Title == name) .List() In this

Orchard CMS on Mono

怎甘沉沦 提交于 2019-12-06 04:03:54
问题 This question might be slightly subjective, but I am unsure where else it would be better suited. I have used Orchard on a number of projects where the server was Windows Server based - integrating with AD, SQL etc to provide a MVC based portal - like stealing candy from a toddler! I have been exploring MonoTouch recently, and installed Orchard on OSX under ModMono as per http://docs.orchardproject.net/Documentation/Running-Orchard-on-Mono. It all seems to run fine, and fast, but I am unsure

How to include a css stylesheet in Orchard module?

自古美人都是妖i 提交于 2019-12-06 03:34:28
问题 I am working on a module for Orchard, and I just want to know how to include a css file. I have done the following with no result: Added a folder "Styles" to the root of my module and included a stylesheet and a Web.config file like in this question. And I have seen this but that's not what I am looking for. EDIT: Ok, solution: When I started working on Orchard I created a new module by just creating a new project in Orchard.Web/Modules folder, but as I read here, my Views/Web.config file has

Adding different CSS files to different pages in Orchard CMS?

一个人想着一个人 提交于 2019-12-05 20:37:25
Let's say we have two pages in Orchard CMS. The homepage and the About US page. I want to use a RoyalSlider on the homepage which has its own CSS file. How do I include it only on the homepage and not on the about us page? In Orchard CMS I am using Contoso as the theme and I tried including the royalslider.css file on the Layout.cshtml using Style.Include but this will include the CSS file over all the pages in the website which is not a good practice. You should use URL Alternates feature for that. It's described here , in the section "URL and Widget Alternates" . After enabling the feature,