Kyle Woolley
Kyle Woolley

Reputation: 813

Is it possible to render a part twice in one display type? - Orchard CMS

I have a content type, Events, that has a part "StartDate" that I need to show twice in the summary view. Is it possible inside placement.info to render the part in "this" zone AND "that" zone?

Upvotes: 3

Views: 79

Answers (3)

mdameer
mdameer

Reputation: 1540

You can't render same shape twice, but simply you can return combined shapes from your driver and render each shape in different zone.

Upvotes: 3

rtpHarry
rtpHarry

Reputation: 13125

Render the zone twice

Probably not through just using the placement.info file but if you edit the .cshtml view you can just render a zone twice.

For a test I just edited my blog detail view to have this code:

    @Display(Model.Content)
    @Display(Model.Content)

It worked, and displayed it twice. It's something you should probably be careful with this as in that example it rendered out my Disqus comments twice which created a clash because the same id was used twice on a single page.

Fine tune it with Part Relocation

If you need to pull a single bit of content (a shape/part) out of an existing zone you can also do it with something called Part Relocation which is explained in this Orchard Harvest Session.

The basic idea is to use placement to isolate it into its own zone:

<Match ContentType="News" DisplayType="Detail">
    <Place Parts_StartDate="MakeUpAZoneName" />
</Match>

(Note: the Match tag is just an example, its the Place you will need to put in whatever match you want)

And then you can render that out in your .cshtml file with @Display() like:

@Display(Model.MakeUpAZoneName)

... other html code ...

@Display(Model.MakeUpAZoneName)

Upvotes: 6

Hossein Panahloo
Hossein Panahloo

Reputation: 520

No its not possible, Only the first one in the file placement.info works.

Upvotes: 0

Related Questions