Nov 28, 2011 at 12:22 AM
Edited Nov 28, 2011 at 12:22 AM
Everyone, Orchard n00b here looking for a bit of guidance. What I want to do seems relatively simple, and I'm not sure the "best" way to go about solving my problem.
I have a custom page layout (Content-Page.cshtml) that looks something like this:
Layout.Title = "Tri Shop - " + Model.Title;
<!-- Content-Page.cshtml -->
<div id="content" class="bg-white left">
<div class="story-panel-edge left no-left-border">
<div class="double-wide-edge-borderless single-tall right">
<div class="small-block left border"></div>
<div class="small-block-edge right no-right-border">
<div class="side-panel-edge right no-right-border">
<!-- THIS IS WHERE I WANT MY IMAGE TO GO -->
What I want to do is add a custom field/part/module to the Page content type so that someone creating a page can select a special image that will be seen, for that page, in a panel on the right side of the page. I want the main Page content to be displayed
in the main panel, given the class "story-panel" in the code above. How should I go about doing this?
I tried creating a custom field called ImageUrl where I would just put the image name, but the ImageUrl content is displayed via @Display(Model.Content). So now I'm going down the route of creating a custom module containing a custom record, custom part,
and custom Migration but that seems like a lot of work for something that should be fairly trivial.
My first goal is just to make it work - I can upload images to the correct folder and just use a url text string to identify the image name associated with a specific page. However, the longer term goal is to have a custom part that allows someone creating
a new page to upload the image that will be displayed. Given that goal, what is my best path?
My biggest failing is in figuring out how to render individual parts/content to my custom layout. Clearly, Model.Content isn't going to grab only the body content but instead will grab all page content. How do I just get the body content and how do
I get other content, such as custom fields or parts that exist on the page?