Ticket (Solved)

'Layout Templates': can they be saved as .cshtml / by code, or…?

Hi all, very new to layouts and Orchard in general and was wondering how I could save my Layout Templates so they don’t have to be manually re-created in the future? A few ideas spring to mind but I would love some input on the best Orchardy-way ;) I haven't used import/export yet, but was wondering if I could export them to code, then implement their creation with my theme being enabled?...Anyhow, better not confuse the issue and let the pro's recommend the best way -- Many thanks in advance, PP

UPDATE: Tried my Export idea, but it only appears to support Custom Elements - no Templates? The only references to Layouts I can find within the DB are ContentItemRecord and [dbo].[OrchardFrameworkContentItemVersionRecord] -- the latter holding the actual Layout elements within the data column (I'm assuming)...I hope there is any easier way than what you imagine I'm currently thinking? Any help would be fantastic, thanks PP

Re: 'Layout Templates': can they be saved as .cshtml / by code, or…?

The best way is to use the Export feature. Since the Layout content type is a content type, you should be able to select it from the list of content types on the export screen. You could then chose to include the exported XML as part of a recipe you would provide as part of your theme. You could even pre-configure your entire site, export everything into a Setup recipe, and make that recipe part of your theme (by storing it in a Recipes folder in the root of your theme).

Monday, February 15, 2016 6:10:34 PM bysfmskywalker

Post a reply

You need to be signed in to post a reply.

Sign In