Zum Inhalt springen

If-Abfrage

Erstellt am 6. Juni 2012 · 2 Antworten · letzte Antwort am 11. Juni 2012

Tags: Frage

w@ ·

Hallo zusammen

Ich versuche mittels einer <f:if Abfrage, aufgrund einer gesetzten Konstante
den "page.includeCSS" zu manipulieren.

Unter Constants habe ich:

css {
  # cat=contrast; type=string; label=Contrast: Value (1) to switch on, (0) to switch off.
  contrast = 0
}

Und im Setup:

<f:if condition="{$css.contrast} == 1">
<f:then>
  page.includeCSS {
    file1 = {$filepaths.css}contrast.css
    file1.title = contrast stylesheet
    file2 = {$filepaths.css}normal.css
    file2.title = normal stylesheet  
  }
</f:then>
<f:else>
  page.includeCSS {  
    file1 = {$filepaths.css}normal.css
    file1.title = normal stylesheet  
  }
</f:else>
</f:if>

Leider werden immer beide Dateien eingebunden.
Hat vielleicht jemand ne Ahnung wo ich da den Fehler mache?

Danke und Gruss
Peter

monk21 ·

Moin,

ist mir neu, dass Fluid-ViewHelper im TypoScript-Setup funktionieren.
Oder verstehe ich etwas falsch?

Wäre nicht das richtiger:

//If the constant {$constant_to_turnSomethingOn} is “1” then this matches:
[globalVar = LIT:1 = {$constant_to_turnSomethingOn}]

Gruß
Thorsten

w@ ·

Hi Thorsten

Dachte ich hätte da mal was gelesen, dass das möglich wäre.
War aber ev. auch nur reines Wunschdenken ;-)

Danke dir trotzdem für dein Feedback.
Löse ich das halt mittels Globals.

Gruss und noch nen schönen Tag
Peter