Reputation: 89170
I have a content type with a title part, a body part and a content picker field.
The overall template for the type content.cshtml controls where the meta, content and footer info is shown. The placement file controls whether a part is in the meta, content or footer.
Each part has it's own template, but I want to make the title link to the content picker's content item, so I need to show information from a part and a field.
Should I (and can I):
Which solution is best and what would that template look like? Or, is there a better solution?
Upvotes: 1
Views: 781
Reputation: 6591
I'd opt for the second solution and create either an alternate for your title part or for the field and leave content as it is.
So if your content was called TestContent, you could create an alternate called
Parts.Title-TestContent.cshtml
And if your content picker field was called MyContentPicker you could access it from your new alternate like so
var url = Url.ItemDisplayUrl((Orchard.ContentManagement.IContent) Model.ContentItem.TestContent.MyContentPicker.ContentItems[0]);
Then slip that into a href and you are good to go. I'm not sure if this is the correct way to do things, but it should work. Maybe someone else has a better way they might share :)
Upvotes: 1