Zum Inhalt springen

TypoScript-Template-Rootpaths für Plugin und Module

Erstellt am 28. April 2011 · 2 Antworten · letzte Antwort am 20. Januar 2012

Tags: Frage

mod_x ·

Moin moin Damen und Herren,

ich entwickel momentan meine Erste Extension auf Basis von Extbase. Soweit alles super. Konzept macht Spaß usw... Doch mich quält jetzt seit einiger Zeit folgende Frage:

Wie weise ich Typo3 an im Backend-Modul die Templates unter EXT:kjr_resmngr/Resources/Private/Backend/ zu verwenden und nicht wie im Frontend-Plugin unter EXT:kjr_resmngr/Resources/Private/ ???

Ich stocher schon eine Weile hier rum..

Ich habe die Extensionen mit dem Extbase Kickstarter v0.9.0 losgetreten und bekomme von Anfang an, wenn ich im Backend-Menu auf das Modul klicke, nicht die in Resources/Private/Backend/ befindlichen Templates angeboten.
Ich nutze TYPO3 4.5.2.

ext_tables.php

<?php
if (!defined ('TYPO3_MODE')){
    die ('Access denied.');
}

Tx_Extbase_Utility_Extension::registerPlugin(
    $_EXTKEY,
    'Kjr_resmngr_fe',
    'Ressourcenmanager'
);

//$TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY . '_kjr_resmngr_fe'] = 'pi_flexform';
//t3lib_extMgm::addPiFlexFormValue($_EXTKEY . '_kjr_resmngr_fe', 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform_kjr_resmngr_fe.xml');




if (TYPO3_MODE === 'BE') {

    /**
    * Registers a Backend Module
    */
    Tx_Extbase_Utility_Extension::registerModule(
        $_EXTKEY,
        'user',     // Make module a submodule of 'user'
        'kjr_resmngr_tool',    // Submodule key
        '',                        // Position
        array(
            'Ressources' => 'list, show, new, create, edit, update, delete',
            'User' => 'list, show, new, create, edit, update, delete',
            'Bookings' => 'list, show, new, create, edit, update, delete',
        ),
        array(
            'access' => 'user,group',
            'icon'   => 'EXT:' . $_EXTKEY . '/ext_icon.gif',
            'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_kjr_resmngr_tool.xml',
        )
    );

}


t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'user_KjrResmngrKjrResmngrTool');


t3lib_extMgm::addLLrefForTCAdescr('tx_kjrresmngr_domain_model_user', 'EXT:kjr_resmngr/Resources/Private/Language/locallang_csh_tx_kjrresmngr_domain_model_user.xml');
t3lib_extMgm::allowTableOnStandardPages('tx_kjrresmngr_domain_model_user');
$TCA['tx_kjrresmngr_domain_model_user'] = array(
    'ctrl' => array(
        'title'                => 'LLL:EXT:kjr_resmngr/Resources/Private/Language/locallang_db.xml:tx_kjrresmngr_domain_model_user',
        'label'             => 'name',
        'tstamp'             => 'tstamp',
        'crdate'             => 'crdate',
        'dividers2tabs' => true,
        'versioningWS'         => 2,
        'versioning_followPages'    => TRUE,
        'origUid'             => 't3_origuid',
        'languageField'     => 'sys_language_uid',
        'transOrigPointerField'     => 'l10n_parent',
        'transOrigDiffSourceField'     => 'l10n_diffsource',
        'delete'             => 'deleted',
        'enablecolumns'     => array(
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
            ),
        'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/User.php',
        'iconfile'             => t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_kjrresmngr_domain_model_user.gif'
    ),
);

t3lib_extMgm::addLLrefForTCAdescr('tx_kjrresmngr_domain_model_ressources', 'EXT:kjr_resmngr/Resources/Private/Language/locallang_csh_tx_kjrresmngr_domain_model_ressources.xml');
t3lib_extMgm::allowTableOnStandardPages('tx_kjrresmngr_domain_model_ressources');
$TCA['tx_kjrresmngr_domain_model_ressources'] = array(
    'ctrl' => array(
        'title'                => 'LLL:EXT:kjr_resmngr/Resources/Private/Language/locallang_db.xml:tx_kjrresmngr_domain_model_ressources',
        'label'             => 'title',
        'tstamp'             => 'tstamp',
        'crdate'             => 'crdate',
        'dividers2tabs' => true,
        'versioningWS'         => 2,
        'versioning_followPages'    => TRUE,
        'origUid'             => 't3_origuid',
        'languageField'     => 'sys_language_uid',
        'transOrigPointerField'     => 'l10n_parent',
        'transOrigDiffSourceField'     => 'l10n_diffsource',
        'delete'             => 'deleted',
        'enablecolumns'     => array(
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
            ),
        'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/Ressources.php',
        'iconfile'             => t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_kjrresmngr_domain_model_ressources.gif'
    ),
);

t3lib_extMgm::addLLrefForTCAdescr('tx_kjrresmngr_domain_model_bookings', 'EXT:kjr_resmngr/Resources/Private/Language/locallang_csh_tx_kjrresmngr_domain_model_bookings.xml');
t3lib_extMgm::allowTableOnStandardPages('tx_kjrresmngr_domain_model_bookings');
$TCA['tx_kjrresmngr_domain_model_bookings'] = array(
    'ctrl' => array(
        'title'                => 'LLL:EXT:kjr_resmngr/Resources/Private/Language/locallang_db.xml:tx_kjrresmngr_domain_model_bookings',
        'label'             => 'status',
        'tstamp'             => 'tstamp',
        'crdate'             => 'crdate',
        'dividers2tabs' => true,
        'versioningWS'         => 2,
        'versioning_followPages'    => TRUE,
        'origUid'             => 't3_origuid',
        'languageField'     => 'sys_language_uid',
        'transOrigPointerField'     => 'l10n_parent',
        'transOrigDiffSourceField'     => 'l10n_diffsource',
        'delete'             => 'deleted',
        'enablecolumns'     => array(
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
            ),
        'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/Bookings.php',
        'iconfile'             => t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_kjrresmngr_domain_model_bookings.gif'
    ),
);

?>

Configuratoin/TypoScript/constants.txt

plugin.tx_kjrresmngr {
view {
        # cat=plugin.tx_kjrresmngr/file; type=string; label=Path to template root (FE)
templateRootPath = EXT:kjr_resmngr/Resources/Private/Templates/
        # cat=plugin.tx_kjrresmngr/file; type=string; label=Path to template partials (FE)
partialRootPath = EXT:kjr_resmngr/Resources/Private/Partials/
        # cat=plugin.tx_kjrresmngr/file; type=string; label=Path to template layouts (FE)
layoutRootPath = EXT:kjr_resmngr/Resources/Private/Layouts/
}
persistence {
        # cat=plugin.tx_kjrresmngr//a; type=int+; label=Default storage PID
storagePid =
}
}


module.tx_kjrresmngr {
view {
        # cat=module.tx_kjrresmngr/file; type=string; label=Path to template root (BE)
templateRootPath = EXT:kjr_resmngr/Resources/Private/Backend/Templates/
        # cat=module.tx_kjrresmngr/file; type=string; label=Path to template partials (BE)
partialRootPath = EXT:kjr_resmngr/Resources/Private/Backend/Partials/
        # cat=module.tx_kjrresmngr/file; type=string; label=Path to template layouts (BE)
layoutRootPath = EXT:kjr_resmngr/Resources/Private/Backend/Layouts/
}
}

Configuratoin/TypoScript/setup.txt

plugin.tx_kjrresmngr {
view {
templateRootPath = {$plugin.tx_kjrresmngr.view.templateRootPath}
partialRootPath = {$plugin.tx_kjrresmngr.view.partialRootPath}
layoutRootPath = {$plugin.tx_kjrresmngr.view.layoutRootPath}
}
persistence {
storagePid = {$plugin.tx_kjrresmngr.persistence.storagePid}
}
}

plugin.tx_kjrresmngr._CSS_DEFAULT_STYLE (
    input.f3-form-error {
        background-color:#FF9F9F;
        border: 1px #FF0000 solid;
    }

    .tx-kjrresmngr-pi1 table {
        border-collapse:separate;
        border-spacing:10px;
    }

    .tx-kjrresmngr-pi1 table th {
        font-weight:bold;
    }

    .tx-kjrresmngr-pi1 table td {
        vertical-align:top;
    }
)



# Module configuration
module.tx_kjrresmngr {
persistence < plugin.tx_kjrresmngr.persistence
view {
templateRootPath = {$module.tx_kjrresmngr.view.templateRootPath}
partialRootPath = {$module.tx_kjrresmngr.view.partialRootPath}
layoutRootPath = {$module.tx_kjrresmngr.view.layoutRootPath}
}
}

Änderungen bei den Pfadangaben innerhalb von constants.txt hat 0 Wirkung. Wo existiert noch ein Hebel?

Bei Einfällen besten Dank im Voraus!!

Gruß,
redmord

typonewbe ·

Hallo mod_x,

ist schon weile her, aber ich stehe gerade vor dem selben ich hab in 4.5.3 eine Extension mit dem Kickstarter erstellt und dabei feststellen müssen das die Extension sich immer die Templates aus dem normalen templates holt und nicht aus
Backend/Templates. Hast du inzwischen schon eine Lösung gefunden?

Danke für die Mühe schon mal im Voraus

Gruß typonewbe

typonewbe ·

Hallo,

ich nochmal.
Konnte das Problem beheben. Also das TypoScript wird Standardmäßig nicht automatisch eingebunden. Daher geht extbase wohl davon aus, das sich die Templates unter Private/ befinden.

Die Lösung hab mir nen TS Template erstellt was unter dem Tab "Enthält" meine Extension als Statisches Template (aus Erweiterungen) einbindet. Dannach Griff auch das Template unter Private/Backend.

Gruß typonewbe