Feature #29423
closed
Add "if" function to includeCSS and includeJS TS object
Added by Alexander Grein about 13 years ago.
Updated about 7 years ago.
Description
Wouldn't it be nice to have the possibility to include a css or javascript depending on a constant?
Example:
page.includeCSS {
colorbox = {$plugin.rzcolorbox.cssPath}
colorbox.if.isTrue = {$plugin.rzcolorbox.cssPath}
colorbox.if.ifFalse = {$plugin.rzcolorbox.deactivate}
}
Usefull also for:
includeLibs
includeJS
includeJSFooter
- Category set to TypoScript
- Complexity set to easy
This is already possible and IMHO it's easier than the proposed solution:
Use this TS-Setup
page.includeCSS {
{$plugin.rzcolorbox.cssPath}
}
and these TS-constants for
the active cssPath
plugin.rzcolorbox.cssPath = colorbox = my/path/to/the.css
the inactive cssPath
plugin.rzcolorbox.cssPath = #
You can even use the constant editor to make it available via check box or selector box.
Not tested though ...
And of course you can deactivate the value depending on another constant the same ways as in the first example.
Setup:
page.includeCSS {
{$plugin.rzcolorbox.deactivate}{$plugin.rzcolorbox.cssPath}
}
Constants for active state:
plugin.rzcolorbox {
cssPath = colorbox = my/path/to/the.css
deactivate =
}
Now you can add a single line to the constants to deactivate the whole line on any desired page:
plugin.rzcolorbox.deactivate = #
Can be configured to make use of the constant editor as well.
Hi Jo,
doing this, it is not possible to use the constant editor type=file parameter anymore.
Also a checkbox (type=boolean) for disabling is not possible.
Using a constant inside the if-function should only be an example.
If the objects get a "real" if-function, include stdWrap functionality, this would open up a lot of more possibilities...
- Status changed from New to Under Review
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF