"<INCLUDE_TYPOSCRIPT:" and multi level conditions
<INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/blub/__ts.txt"> [globalVar = GP:test = 1] <INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/plob/__ts.txt"> [global]
does not work right if there are other conditions inside /plob/__ts.txt, as there are currently no multi level conditions (one condition around other conditions) possible. So you have to handle this in the file itself (currently).
I first thought about another problem here (didn't really dig into this until now), but now I think this is a lot more work, but I'll take a look at it anyway
(issue imported from #M4150)
[FEATURE] support condition in INCLUDE_TYPOSCRIPT tag
An optional property 'condition' will only include the file or directory
if the condition is met.
Reviewed-by: Daniel Goerz <firstname.lastname@example.org>
Tested-by: Daniel Goerz <email@example.com>
Reviewed-by: Oliver Thiele <firstname.lastname@example.org>
Tested-by: Oliver Thiele <email@example.com>
Reviewed-by: Xavier Perseguers <firstname.lastname@example.org>
Reviewed-by: Anja Leichsenring <email@example.com>
Tested-by: Anja Leichsenring <firstname.lastname@example.org>
#3 Updated by Martin Holtz over 11 years ago
[globalVar = GP:test = 1]
<INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/assets/tstest.txt">
works fine for me.
[globalVar = GP:test = 1]
page.2000 = HTML
page.2000.value = <!-- HELLO WORLD -->
is ist possible that you made an other mistake?
#5 Updated by Thorsten Kahler almost 6 years ago
- Category deleted (
- Status changed from Accepted to Needs Feedback
- Assignee deleted (
- Target version deleted (
- PHP Version deleted (
- Complexity set to nightmare
+1 for wont-fix
The only way to fix that would be nested conditions which we can't realize in TS 1.0: every inclusion of a TS snippet, via DB relation or
<INCLUDE_TYPOSCRIPT...>, adds an implicit
[global] to the end of that snippet to make sure that all conditions are working only locally. Changing that would surely be breaking many installations.
#6 Updated by Stefan Neufeind about 5 years ago
If I understand it right then conditions inside the included file do not work? Or what is the problem? Could it be that the condition (to include a file or not) is evaluated after resolving the include (including it's code)? Could we do the includes while evalutating the conditions, thus allowing to conditionally include the file or not? After the inclusion of course the mentioned implicit [global] occurs.
#8 Updated by Niels Tiedt over 4 years ago
- Status changed from Closed to New
It would be nice if you could implement a condition feature for the external TS-file include.
Maybe it is possible to fix the above problem with an additional attribute in the INCLUDE_TYPOSCRIPT-Tag.
<INCLUDE_TYPOSCRIPT:source="file:mypath/myfile.ts":condition="globalVar = TSFE:id = 1">
#10 Updated by Jigal van Hemert over 2 years ago
- Status changed from New to In Progress
It can probably be done if we add an optional property to the tag:
<INCLUDE_TYPOSCRIPT:source="file:xxx" condition="yyyy"> <INCLUDE_TYPOSCRIPT:source="dir:zzz" extension="ts" condition="yyyy">
In the core the condition matcher object is already present and must simply be passed when the includes are processed. The condition matcher object can be optional; if no condition matcher object is available in third party code the condition is simply ignored.