How can I create template for view of widget?

Topics: Administration, Customizing Orchard, General, Writing modules, Writing themes
Jul 20, 2011 at 10:26 AM

Hi,

I create a few widgets that they have the same header I would like to know how can I create template for view (.cshtml) of these widgets and please give me the example code.

Widget A

<div>
	<div class="header">
		@Model.Title
	</div>
	<div class="content">
		<!-- Content Widget A -->
	</div>
</div>

Widget B

 

<div>
	<div class="header">
		@Model.Title
	</div>
	<div class="content">
		<!-- Content Widget B -->
	</div>
</div>

Thanks,

chichow

Coordinator
Jul 26, 2011 at 1:35 AM

The header could probably be moved into the wrapper (widget-wrapper.cshtml) but even if you don't do that, the code duplication here is fairly minimal and you could probably live with what you just wrote.