Orchard CMS create theme view for my content type - orchardcms

I am using orchard cms with the bootstrap theme.
I have created a content type: House
it contains FIELDS
image (media picker field)
Property Type (taxonomy field)
Location (taxonomy field)
It has PARTS
common
body
publish later
Title
Autoroute
I want queries of houses and be able to choose the view/ layout for them
e.g. layout called HouseList (for sidebars mainly) which will render: title, image and link to house, possible location and type but with out the links as defaulted. And then a fullDetails layout and a image only layout (so i can show a jquery image reel a widget say in a quadzone) How can i do all this please, i have tried in view Content-House.cshtml etc but i cant access the details model.content to choose what to display.
Im sure when i get the idea of how to do 1 i should be able to sort the rest. I have read documentation etc but there are so many different ways, ie placement file, change the parts, contents, create classes to handle display etc. sureley i am missing something simple like create a view for each list i want eg. houue-list, house-details, house-imageONly and then manipulate content.
Please help i have been trying different things for getting this site running for weeks and not getting very far. Examples would be fantastic but i have searched google for hours and found similar but nothing with enough details for a meer beginer.
Thanks

The standard way of doing that is placement to move things around and alternate templates for the different parts and fields. You can specialize placement and alternates with the display type, which is Summary when rendering in a list such as what a projection returns, and Detail for the detail view. More info on placement can be found here: http://docs.orchardproject.net/Documentation/Understanding-placement-info and on alternates here: http://docs.orchardproject.net/Documentation/Alternates
Now if you prefer to completely take over the rendering and do without placement, here are a few posts that may help:
http://weblogs.asp.net/bleroy/archive/2011/07/31/so-you-don-t-want-to-use-placement-info.aspx
http://weblogs.asp.net/bleroy/archive/2011/03/27/taking-over-list-rendering-in-orchard.aspx

Related

How to create Layout Based on Layer in Orchard

I am trying to create a different layout for a sub-section of my website using Orchard.
Let's say I wanted to give www.site.com/Shop a different layout from the rest of the website; how would I go about doing this?
I have tried looking for a way to do this using layers but have got stuck.
There are several ways to achieve different layout, since I don't know your specific needs I'll throw in some extra possible routes
Use url shape alternate (I guess you need this one)
You have to enable Url Alternates module and it lets you create shape alternates based on url. For example if your page is www.site.com/shop you can then create view under your theme Layout-url-Shop.cshtml and it will be used instead of default Layout.cshtml on your shop.
Orchard documentantion: URL and Widget Alternates
Use 1.x or wait for 1.9
There you can define dynamically different layout per content item aka page. But I find it good only for content not the base layout which is present in layout.cshtml
Create minisite
How to create a minisite inside your Orchard website

Orchard CMS: Add a stylesheet to a page

Setup:
I am using Orchard CMS 1.6.
I have a site where I need to be able to set the background color of the whole page. Ie, I need to style the body tag.
I could use the LayoutSelector module and have distinct layouts. However, the only difference in each layout is that the background-color rule for the body tag is different. So it seems a very un-dry way of doing things.
I can't find any way to make Vandelay.Classy add a distinct id or class to the body tag (it adds, as I understand it) an id or a class to the outer tag of a content type. In my case, that isn't the body tag.
So that is no good, I really do need to customize the body tag.
How to do this?
Note:
I need 3 different background colors. I also have a two column layout and a three column layout. [I use (a modified version of) the layoutSelector module to achieve this.] So to have 3 different colors of background, and I used layouts to achieve this, I would need 6 different layouts: TOTAL overkill.
There must be a better way...
From any cshtml file, you should be able to access the Layout shape. From pretty much anywhere else, you can still get to the Layout shape through WorkContextAccessor. Once you have a reference to the Layout shape, you can do Layout.Classes.Add("the-class-you-want").

How can I use alternate shape templates in different zones on the same page?

I'm trying to create a theme in orchard. I have a main content zone and a sidebar zone which is on the right of my main content area (2 column layout). The main content area displays a list of blog posts (including tags, etc. Standard Orchard behaviour).
In the sidebar I would like to display the recent blog post widgets. However, the standard widget renders tags, published date etc. I do not want to display this information in the sidebar zone.
The placement file does not seem to be the right place to configure this as I can't specifically target the Parts_Tags_ShowTags shape in the sidebar zone. Neither does it seem to be possible to create a new template like Tags.ShowTags-Sidebar.cshtml
Any suggestions on how to modify/hide a shape in one zone on a page but not the other?
You can either use an alternate (shape tracing can help with that) or take this over entirely (see this post for details: http://weblogs.asp.net/bleroy/archive/2011/03/27/taking-over-list-rendering-in-orchard.aspx)

Overriding Core Shapes - Orchard CMS

I currently have a Content Type called "News" which is very simple (No custom properties etc.). I am trying to style this Content type when it occurs on a page of a specific layout, in this case a "News" page.
So - I have the layout that a News page will inherit from (Layout-url-News.cshtml), however I cannot seem to get the Content to display or inherit from a template (I have tried creating alternates such as Zone-url-News.cshtml and Zone-Content-url-News.cshtml, however both result in having no content at all.)
I had create both of the mentioned alternates by hand, as Designer Tools was unable to generate an alternate (The relative virtual path 'Orchard.Core.Shapes.CoreShapes::Zone' is not allowed here)
Basically - I cannot figure out how to style the content found on a specific page, (Title, Tags, Date, Body) as the Content always seems to inheirit from the base shape.
If your point is to style content in a zone, u might find it easier to use css. The layout system makes it really easy to identify the elements your interested in styling by using css selectors.
for example
.aside1.news { ... }
That takes care of 80% of styling needs
Most of the remaining is taken care of by the placement.info file which allows you to indicate which fields and what order for contenttypes and viewstypes (summary and detail)
the remaining needs are address by overriding the contentitem.view.
But you seem to indicate that you want to set the style for a contenttype in a specific zone for a url. So... You have the same contentType in different zones at the same url? I cannot imagine what you are doing. :)
Long and short, it sounds like your focused on the zone but it might be more helpful to focus on the contenttype or better yet, css. I ran into the same thing with url alternates suggesting alternates that aren't valid. It seems weird that it suggests zone alternates. I don't think those those are allowed.

web part title in xsl

I'm investigating a possible solution where all web parts on my page should be rendered without a chrome, meaning that the default title portion of the web part will be hidden, but the title supplied in the web part properties should be used elsewhere in the web part.
I have found several solutions on how to get the page title but none around how I can crab the web part title and display it using Xsl, would like to return this within the ItemStyle.xsl
I used a method of return the raw xml data for the web part, but by default is the title of the web part not return, and I found no reference other than OuterTemplate.GetTitle() which points to the Title column of a list, to support my solution.
Is this possible?
It is probably not accessible through the xsl itself, as the title of the webpart is not part of the xml data coming through. If you really need it, you could show it on the page and use JQuery/Javascript to scrape it off. Otherwise, I might find a different way to provide the name, maybe with a query parameter.

Resources