1

Is it possible to do something like that (doesn't work):

[{mysettings.id} in tree.rootLineIds]  

@import './TypoScript/'

[END]

Background: I have a Set Set, but want to use it only on specific page-Ids (and want to set these ID via Site Settings).

Thanks!

I'm using TYPO3 13

2 Answers 2

1

You can set condition as below in setup.typoscript file

[{$plugin.tx_myext.settings.myPageId} in tree.rootLineIds]
    @import 'EXT:my_ext/Configuration/TypoScript/'
[global]

assuming your Settings.yaml

plugin:
  my_ext:
    settings:
      myPageId: 123

settings.definitions.yaml

  plugin.tx_myext.settings.myPageId:
    category: MyExt.settings
    type: int
    label: 'Page of the MyPage'
    description: ''
    default: '0'

This will only include ".typoscript" files under directory "EXT:my_ext/Configuration/TypoScript/" when the condition matches

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! That worked so far. But: I want to set a value via settings.definitions.yaml (so a user can edit the value via "Site Management" -> "settings" in the backend). Is there a way to do that?
yes you need to define this "plugin.tx_myext.settings.myPageId" in the settings.definitions.yaml I have updated my answer, please check it
0

If you want to use the TypoScript on multiple pages, then i would suggest to implement it as follows:

First add the uids to your settings.yaml

plugin:
  my_sitepackage:
    settings:
      pageUids: 25,26

And then add this condition in your TypoScript setup:

[traverse(page, "uid") in [{$plugin.my_sitepackage.settings.pageUids}]]
  # My fancy TypoScript
[END]

1 Comment

Thanks! See my comment on Ravis answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.