Project

General

Profile

Actions

Feature #29423

closed

Add "if" function to includeCSS and includeJS TS object

Added by Alexander Grein over 12 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
Start date:
2011-09-01
Due date:
% Done:

100%

Estimated time:
PHP Version:
Tags:
Complexity:
easy
Sprint Focus:

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

Actions #1

Updated by Andreas Wolf over 12 years ago

  • Category set to TypoScript
  • Complexity set to easy
Actions #2

Updated by Jo Hasenau over 12 years ago

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

Actions #3

Updated by Jo Hasenau over 12 years ago

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.

Actions #4

Updated by Alexander Grein over 12 years ago

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

Actions #5

Updated by Gerrit Code Review about 12 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/8844

Actions #6

Updated by Gerrit Code Review about 12 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/8844

Actions #7

Updated by Tolleiv Nietsch about 12 years ago

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

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF