Hm, this sounds a great extension for ContentArea render :)
I would just use Tags for selecting the right template/view. All built in.
I have a content area which contains blocks which contain content areas which contain blocks ... :)
So the "lowest level" block needs to take a display option from the top level content area, and I don't want to control this from the edit mode :)
To make the things more clear:
Let's say that I want to display a list of employees on the start page and about us page.
There's no separate page for each employee, and I want to reuse the content so I decided to create shared blocks.
On start page, I want to display the following info for each employee: photo, name, etc.
On About Us page, I want to display: photo, name, title, fancy background image, etc.
I don't want to let the editor to control the rendering because that's written in stone by our GUI / UX guys :)
Dejan, if that's requirements recommend to take a closer look at Alloy templates and tags. As Fredrik said, that should just solve your stuff. I though you have more complex requirements :)
Thank you guys! Works like a charm :)
I have an EmployeeBlock which can drag & dropped to ContentAreas on StartPage, AboutUs page, etc.
Can I control the rendering of that block based on current page?
When I'm on the start page and call Html.PropertyFor(x => x.MyContentArea), I want to use one view / display template, and when I call the same helper on AboutUs page, I want to use other view / display template.
Can I somehow submit additional html attributes to PropertyFor helper and then use different views based on that value? Something like this:
Any helper would be greatly appreciated!