Description
A project in a project allows you to connect a ready-made, recorded project to the current project. This action is similar to Plugins .
How to add an action to a project?
Via the context menu Add Action → Project → Project in project
Or use smart search .
Application
Most often, a Project in a project is used for repeating parts:
Example: You are working with a website. To work with this site, you have several separate templates: product parser, users parser, message mailer. To work on the site, you must be logged in. Each of these templates contains the same piece of logic - checking whether the user is authorized and, if not authorized, then authorizing on the portal. A good solution would be to move the verification and authorization section into a separate, small sub-template and connect it in the right places. And in the future, if you want to make changes to the authorization check logic, you will have to make changes only in one place - in the subtemplate (and not in several templates), which seriously reduces the likelihood of making a mistake.
You can also bring universal functions into subprojects that can be used in different templates:
text generation
checking text for uniqueness
uploading images to image hosting and much more
Another possible application would be to break one large template into subtemplates
sometimes templates grow to very large sizes, especially when it is a “combine” for working with any resource: registrar, parser, checker, mailer. It's a good idea to split one large template into smaller parts and include these parts as a Project in a project, and only set the settings from the main template.
any template can be used as a nested one and, as in the case of Plugins , here you are limited only by your imagination
How to work with an action?
Basic settings
Path to the nested project
The absolute path to the subtemplate is specified here (you can use variable macros. In the screenshot you can see the {-Project.Directory-}
variable - the path to the current project folder. In order for this variable to be automatically set when writing a project, you must enable the corresponding setting )
Pass project context (project.Context)
project.Context allows you to save C # objects and transfer them between different parts of the template. This option is used when working through the Custom C# code action.
Open browser if necessary
Enabling this setting allows the nested template to launch the browser even if it is disabled in the external project via Project Settings
Passing Variables
Variable mapping
In this window, data is transferred from an external project to an internal one. You can only transfer data using variables.
Associate variables with the same names
When this option is enabled, all variables whose names are identical in both projects will be automatically mapped without the need for manual configuration.
Manual setting takes precedence over “Matching…”.
Example: if the option “Map variables ...” is enabled and both projects have a variable named variable , but you manually, through the settings, mapped the variable variable of the internal project to another variable of the external project, for example second_var, then the internal project will now be associated with the variable second_var .
Don't pass values if execution has failed
By default, all changes to variables in the internal project are reflected in the variables from the external project. When this setting is enabled, changes to variables will be ignored by the external project in case of an erroneous completion of the internal one.
Usage example
An example is sending yourself notifications via email.
You can create a template that will automatically, based on the transmitted email, determine the settings for connecting to the server. You will only have to transfer the message text, sender data, recipient data from an external project.
Selling templates that contain nested projects
When selling your templates that are used by nested projects, you should not forget about the commission .
Project loading error
If during the creation of the project such a window appeared and the error "Executing the action ProjectInProject Processing error" appears in the log, then with a high degree of probability the problem is that you are trying to run a closed template on inactive equipment.
To fix this, you need to go to your Personal Account, to the Equipment tab and activate the equipment you are currently working on.
Search for a project with the extension .zp when performing the action "Project in project"
Added in ZennoPoster 7.4.0.0
When this setting is enabled, if the action uses a project of the old format with the .xmlz extension, then if it is absent, a project with the same name, but with a new .zp extension will be searched.
.xmlz - ZennoPoster project extension, which was used in ZennoPoster 5 and below
.zp - project extension used in ZennoPoster 7.