You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assume you have a list of sports players with information about them
You want to make a template that will define a kind of summary for 1 player only
Then you want to generate the document with the summary for all player, 1 by page
You have to clone a surrounding block in your template, then fill the data for each instance of player
From now, you have to call on your php code cloneBlock, then setValue, that means you have to know when you code with pattern is block and which one is variable. I would call it PHP code driven.
If you define in a different way blocks and variable, then you can make generic code that will list the document blocks and variables, and apply some processing, whatever the document will be. I would call it document driven.
Note it can be done by searching closing pattern (variables are blocks without closing pattern), but when you use the same name for a block and a variable (that is to say when you write inside the block a data that is also related to the number of data instance, then this rule begins to be more complicated to implement.
Another point. For a real word template document processing, the block management order is important to manage complexity.
Not separating block and variable means variables are blocks that are not closes. Which means errors in blocks definition (let say 1 letter typing error) means the blocks will be understood as 2 variables...and not as an error.
Is your feature request related to a problem? Please describe.
In TemplateProcessor.php, the following characters are defined
And are used for:
Then the cloning blocks macro should be replaced by '' if only used to manage blocks.
It is even more annoying if you want to use a variable that is used inside a block to duplicate a block...
Describe the solution you'd like
Allow to define different characters for variables and blocks
Describe alternatives you've considered
No generic way to distinguish between blocks and variable in an automated way, with no assumption in the document
Additional context
My goal is to define the way the template is filled from the template itself, and not from any PHP code.
The text was updated successfully, but these errors were encountered: