Peon
Peon

Reputation: 8020

TYPO3 is not reading setup.txt or constants.txt of my extension

I'm developing on 7.6 currently. I have made a few minor plugins that need to have their templates overridden for different pages, but I cant get TYPO3 to do this.

I have added static file include in sys_template.php:

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
    'my_contacts',
    'Configuration/TypoScript',
    'Main Template'
);

that contains setup.txt and constants.txt:

enter image description here

As you can see, I also added it in static.

setup.txt

plugin.my_contacts {
    view {
        templateRootPaths {
            0 = EXT:my_contacts/Resources/Private/Templates/
            1 = {$plugin.my_contacts.view.templateRootPath}
        }

        partialRootPaths {
            0 = EXT:my_contacts/Resources/Private/Partials/
            1 = {$plugin.my_contacts.view.partialRootPath}
        }

        layoutRootPaths {
            0 = EXT:my_contacts/Resources/Private/Layouts/
            1 = {$plugin.my_contacts.view.layoutRootPath}
        }
    }

    settings {
        cssFile = {$plugin.my_contacts.settings.cssFile}
    }
}

constants.txt

plugin.my_contacts {
    view {
        # cat=plugin.my_contacts/file; type=string; label=Path to template root (FE)
        templateRootPath = EXT:my_contacts/Resources/Private/Templates/
        # cat=plugin.my_contacts/file; type=string; label=Path to template partials (FE)
        partialRootPath = EXT:my_contacts/Resources/Private/Partials/
        # cat=plugin.my_contacts/file; type=string; label=Path to template layouts (FE)
        layoutRootPath = EXT:my_contacts/Resources/Private/Layouts/
    }

    settings {
        # cat=plugin.my_contacts/file; type=string; label=Path to CSS file
        cssFile = EXT:my_contacts/Resources/Public/Css/news-basic.css
    }
}

The contents used to be simple, but at this stage, I have them copied from news plugin, so it has now more settings, but I dont see those entries when I check the Template Analyzer or try to access settings in vew/controller. Also, when I try to override the template paths in a template content in a page, nothing happens there either.

The plugin Templates themselves are recognized and read, I just cant get them to be overridden (or read settings from setup).

enter image description here

I read lots of examples but cant find what I'm missing, so any hint is apreciated.

PS: Also, I have cleared all system caches and autoload information, just in case. Didnt help.

Upvotes: 0

Views: 1738

Answers (2)

Paul Beck
Paul Beck

Reputation: 2685

For now you have just registered the static Typoscripts for usage in Typoscript Templates. Please select your Typoscript Template using the "Template" module in the backend and go to "Edit whole Template record". On "Includes" you now see all extension that have registered static Typoscript like your extension and include them to your current Template. (see Screenshots below).

enter image description here enter image description here

Upvotes: 3

Thomas Löffler
Thomas Löffler

Reputation: 6144

Did you include the static template in your TypoScript template?

  1. Open TYPO3 backend
  2. Head to module "Template"
  3. Select your home page
  4. Select Info/Edit in the select box at the top
  5. Click on the bottom button "Edit the whole template record"
  6. Head to tab "Includes"
  7. Head to field "Include static (from extensions)" and select your TypoScript. In your case it should be titled "Main template (my_contacts)"

Upvotes: 1

Related Questions