Let me go through how the subtemplate execution works real quick. There are two ways to execute a subtemplate. First, using the depricated method \"void ExecuteTemplate(string path)
\". This will pass the current ZuesContext object as it is (with the MyMeta, Input, and Output objects attached) into the subTemplate as if it was just pushing that template code in the spot of the ExecuteTemplate command. The second way to execute a subtemplate is with the \"Execute(string path, bool copyContext)
\". If you set the copyContext parameter to false, it behaves just as the depricated ExecuteTemplate method does. If you set the copyContext parameter to true, a new ZeusContext object is created and the objects and data are copied into it. So basically, when you write to the output object in the subtemplate, it's writing to it's own context object. This saves you from having to call output.clear().
I use template groups more than anything in my real job. A template group is just a type of template that has an input form for collecting data into the context, and then a list of temlplates to execute. Each template can run on it's own, but when the template group is executed, you only have to collect data once. There is a Sample TemplateGroup that comes with MyGeneration at \"Samples.Other.Template Group Example\".
I think using Template Groups is a better solution to your problem that subtemplates. Either way, you should be able to get everything working without a hitch. If you're losing the MyMeta Language property, it may have to do with you reconnecting MyMeta every time you start the template. Try setting it again from the input variable that is always in the context.
Here are the variables that exist in the Context (populated from the default settings):
- __version The MyGeneration Application Version.
- __defaultTemplatePath The location of templates that should be displayed in the template browser.
- __defaultOutputPath The default output path.
- __dbDriver The default database driver.
- __dbConnectionString The default database connection string.
- __domainOverride True or false based on the Domain Override setting in the default Application Settings.
- __dbTarget The selected DB Target
- __dbTargetMappingFileName The DB Targets file path.
- __dbLanguageMappingFileName The Language Mapping file path.
- __language The selected language.
- __userMetaDataFileName The User Meta-Data file path.