Inserting custom text into html widget from a recipe?

Topics: Customizing Orchard, Installing Orchard, Writing modules, Writing themes
Mar 2, 2012 at 5:16 PM
Can I have the HTML widget insert custom text/read from a custom txt file when creating a site from a custom recipe?

<command>
	widget create HtmlWidget /Title:"Third Leader Aside" /Zone:"TripelThird" /Position:"5" /Layer:"TheHomepage" /UseLoremIpsumText:true
</command>

So do something like this
<command>
	widget create HtmlWidget /Title:"Third Leader Aside" /Zone:"TripelThird" /Position:"5" /Layer:"TheHomepage" /CustomTextFile:"SomeTxtFile.txt"
</command>


Coordinator
Mar 2, 2012 at 6:19 PM

The issue is that recipes are just plain xml files, which can be used by the import/export module, so having a file text here would not make sense in general. But you might open a bug for that.

Mar 3, 2012 at 3:29 PM
Edited Mar 3, 2012 at 3:33 PM
odnxe wrote:
Can I have the HTML widget insert custom text/read from a custom txt file when creating a site from a custom recipe?

sebastienros wrote:

The issue is that recipes are just plain xml files, which can be used by the import/export module, so having a file text here would not make sense in general. But you might open a bug for that.

There was a point where I wanted the exact same thing but the command line is very limited.  Instead, you can add any content for *any* type as part of the data part of the recipe.  Here is an example item I have:

 

    <View Id="/Route.Slug=services" Status="Published">      <CommonPart Owner="/User.UserName=admin" CreatedUtc="2011-12-31T19:28:00Z" PublishedUtc="2011-12-31T19:28:00Z" ModifiedUtc="2011-12-31T19:28:00Z" />      <RoutePart Title="Services" Slug="services" Path="services" />      <MetaPart Keywords="Services, Another Key Word, yet another" Description="This is services page." />    </View>

To figure out the proper structure, you can simply use the import/export functionality if you want to create the content in your test site then import it into your site as part of the recipe or later as part of a separate file.

Your point is valid though.  I'd love to figure out the proper way to extend the import/export capability as part of a recipe to allow my recipe to reference other XML files.  For larger sites, I have multiple people and some source code repos do not exactly treat XML files as first class citizens so having each section of the site in a separate data xml file would help.