Feature #16525

"<INCLUDE_TYPOSCRIPT:" and multi level conditions

Added by Wolfgang Klinger about 11 years ago. Updated about 1 month ago.

Status:
Closed
Priority:
Should have
Category:
TypoScript
Target version:
Start date:
2006-09-04
Due date:
% Done:

100%

PHP Version:
Tags:
Complexity:
nightmare
Sprint Focus:
PRC

Description

<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)


Related issues

Related to TYPO3 Core - Task #69789: Missing checkbox in the TypoScript Object Browser for conditions set in <INCLUDE_TYPOSCRIPT ...> New 2015-09-14
Related to TYPO3 Core - Bug #76236: INCLUDE_TYPOSCRIPT condition PIDinRootline does not work correcty Closed 2016-05-19
Related to TYPO3 Core - Bug #80150: TypoScript after include line with not matching condition is discarded Resolved 2017-03-06

Associated revisions

Revision c4eec960 (diff)
Added by Jigal van Hemert about 2 years ago

[FEATURE] support condition in INCLUDE_TYPOSCRIPT tag

An optional property 'condition' will only include the file or directory
if the condition is met.

Resolves: #16525
Releases: master
Change-Id: I4be8b93d733ef40601a2943ebad357c095f997ad
Reviewed-on: http://review.typo3.org/42431
Reviewed-by: Daniel Goerz <>
Tested-by: Daniel Goerz <>
Reviewed-by: Oliver Thiele <>
Tested-by: Oliver Thiele <>
Reviewed-by: Xavier Perseguers <>
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>

History

#1 Updated by Michael Stucki about 11 years ago

Please allow me to change the priority of this bug.

#2 Updated by Michael Stucki about 11 years ago

Assigned to myself by mistake, sorry.

#3 Updated by Martin Holtz about 11 years ago

[globalVar = GP:test = 1]
<INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/assets/tstest.txt">
[global]

works fine for me.
TYPO3 4.0.1

what does

[globalVar = GP:test = 1]
page.2000 = HTML
page.2000.value = <!-- HELLO WORLD -->
[global]

is ist possible that you made an other mistake?

#4 Updated by Stefan Neufeind over 5 years ago

@core: How do we go about this? There are no multi-level conditions planned one way or the other. And if you have conditions in external files that for sure gets tricky.
Looking at the age of this ticket, should it maybe be closed wont-fix?

#5 Updated by Thorsten Kahler over 5 years ago

  • Category deleted (Communication)
  • Status changed from Accepted to Needs Feedback
  • Assignee deleted (Wolfgang Klinger)
  • Target version deleted (0)
  • PHP Version deleted (4)
  • 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 over 4 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.

#7 Updated by Alexander Opitz over 4 years ago

  • Status changed from Needs Feedback to Closed

No feedback for over 90 days.

#8 Updated by Niels Tiedt almost 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">

#9 Updated by Susanne Moog over 2 years ago

  • Sprint Focus set to PRC

#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.

#11 Updated by Jigal van Hemert over 2 years ago

  • Category set to TypoScript
  • Assignee set to Jigal van Hemert
  • Target version set to 7.5

#12 Updated by Gerrit Code Review over 2 years ago

  • Status changed from In Progress to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42431

#13 Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42431

#14 Updated by Gerrit Code Review over 2 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42431

#15 Updated by Sebastian Schmal over 2 years ago

jep i have the same problem in T3 6.4.xx

[globalVar = LIT:1 = {$ck.theme.enable}]
    <INCLUDE_TYPOSCRIPT: source="FILE: EXT:test/Configuration/TypoScript/AllConstants.ts">
[global]

#16 Updated by Gerrit Code Review over 2 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42431

#17 Updated by Gerrit Code Review about 2 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42431

#18 Updated by Gerrit Code Review about 2 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42431

#19 Updated by Gerrit Code Review about 2 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42431

#20 Updated by Gerrit Code Review about 2 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42431

#21 Updated by Gerrit Code Review about 2 years ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42431

#22 Updated by Jigal van Hemert about 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#23 Updated by Sebastian Schmal about 2 years ago

dissolved in T3 6.2 ?

#24 Updated by Jigal van Hemert about 2 years ago

Sebastian Schmal wrote:

dissolved in T3 6.2 ?

No solution for 6.2.x. It's a feature so it will only go into new releases (7.5 in this case).

#25 Updated by Sebastian Schmal about 2 years ago

mhhh, we need this in 6.2 :(
Is there another solution for 6.2 ?

#26 Updated by Niels Tiedt about 2 years ago

You can set the conditions in the external ts-file.

#27 Updated by Sebastian Schmal about 2 years ago

Niels Tiedt wrote:

You can set the conditions in the external ts-file.

jep this works.

#28 Updated by Riccardo De Contardi about 1 month ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF