Nested if and single quotes inside block
I am using OpenTBS for several years now. I have an issue when using nested if-then-else conditions, that contain single quotes as content, inside a block. The parsing is not done as suspected.
For this example, I have a block with 2 records inside a table (template created with LibreOffice).
Here is an example of the source code:
Below, you can find the output. My concern is in "Test Block2". You can see that at a certain point the single quote of the condition is visible and the parsing goes wrong.
How can I fix this issue? Is there a more proper way of implementing nested if-structures?
Re: Nested if and single quotes inside block
In a then/else expression delimited with single-quotes (') , all single-quotes inside should be escaped (that is doubled with two single-quotes), just like you did with « 'Begin if blo''ck 2' ».
In you snipped, it is not done with « ... then 'Begin nested ... » and after.
But in my opinion such complicate expressions for if/then/else should no be done in the template side.
This is not a Template Engine job to compute complicated if/then/else.
You'd better use parameter "ondata" with a custom PHP function in order to arrange the data, and then have a simple TBS field in the template.