Ticket (Solved)

Layout Projection Element [Normal behaviour or Bug]?

Ok, so I have implemented everything that sfmskywalker suggested in this ticket: http://orchardpros.net/tickets/9397 [not critical to read], more precisely:

6 Pages and 1 'synopsis' Page that simply includes a 'Projection Element' to display the content of the 6 pages.

The results returned are slightly unexpected - no content - just a Title and Date metatag? Trying to use 'Tracing' on the page doesn't work, as only some elements are shown, whilst others don't get picked-up by tracing [appears to be a problem with Layouts/Tracing].

So I have also set up a simple Projection [not the Layout version] with the same query, which works better - as in - it displays title/meta/content snippet along with the '…more' button, so I assume I would be able to style it with Placements and have it purely display all the content and not a summarized version?...and 'yes', tracing appears to work normally.

So I suppose my question is: when using Projection Element, do the normal Placement rules apply and would alternates still work […even though I can't discover what they are] - so truly don't know how I'm going to go about that?

Ultimately, I need to achieve what Sipke wrote here: Use your theme to provide markup for the "Summary" (or a custom display type) view of the content items. Alternatively, take over the rendering of the projection page entirely by providing the Shape layout for the Query used by the projection and handle all the rendering of each content item yourself. Whatever you choose, you will be able to provide common wrapper HTML for each rendered item. …but I can't discover how to go about it?

Any help greatly appreciated as always. Thanks PP

Re: Layout Projection Element [Normal behaviour or Bug]?

Hi there, pretty sure everything you're struggling with can be found here (written by the Grandmaster himself): [lihttp://www.ideliverable.com/blog/ways-to-render-lists-of-thingshttp://www.ideliverable.com/blog/ways-to-render-lists-of-things) Re: Projection Element tracing, I think you maybe right as I struck some inconsistencies as well but followed the advice in the aforementioned article with great result. Perhaps filing a bug would be appreciated if you can reproduce such, or if you're lucky, Sipke may offer some further insight. Good luck and happy coding :)

Sunday, January 24, 2016 2:15:49 AM bydyrgutt
  • dyrgutt
  • Lv. 01 Rookie
  • Total EXP: 21

Re: Layout Projection Element [Normal behaviour or Bug]?

Nice! Thanks for the great resource, though I'm still in the same boat - I can't get the content to display i.e. The Layout of each page? Using Sipke's tutorial i've taken over the rendering with:

@using Orchard.ContentManagement
@using Orchard.Core.Title.Models
@using Orchard.Layouts.Models

    var webPages = ((IEnumerable<ContentItem>)Model.ContentItems).ToList();

@foreach (var wp in webPages)
    var titlePart = wp.As<TitlePart>();
    var wpTitle = titlePart.Title;

    var layoutPart = wp.As<LayoutPart>();

    <p>@T("{0} Title is ", wpTitle)</p>

...but all that is displayed in the HTML for the layout is the text:


though title is appearing correctly? Am I using the right technique? Thanks PP

Sunday, January 24, 2016 6:27:12 AM bypigpen
  • pigpen
  • Lv. 02 Rookie
  • Total EXP: 58

Re: Layout Projection Element [Normal behaviour or Bug]?

Display() is used to render a dynamic shape / model. But from an IContent (content item, content part...), before, you have to build the shape. Try one of these depending on the display type you want:

@Display(BuildDisplay(layoutPart, "Detail"))
@Display(BuildDisplay(layoutPart, "Summary"))


Sunday, January 24, 2016 9:14:04 PM byjtkech
  • jtkech
  • Lv. 13 Rookie
  • Total EXP: 1028

Post a reply

You need to be signed in to post a reply.

Sign In