代码之家  ›  专栏  ›  技术社区  ›  Peon

typo3未读取扩展名的setup.txt或constants.txt

  •  0
  • Peon  · 技术社区  · 7 年前

    我现在正在7.6开发。我制作了一些小插件,它们需要为不同的页面重写模板,但我不能让typo3这样做。

    我在 sys_template.php中添加了静态文件include。

    \typo3\cms\core\utility\extensionmanagementutility::addstaticfile(
    '我的联系人',
    '配置/类型脚本',
    '主模板'
    ;
    

    其中包含setup.txtconstants.txt:。

    如您所见,我还将它添加到了static中。

    setup.txt

    plugin.my_contacts{
    视图{
    圣殿骑士团{
    0=ext:my_联系人/资源/私人/模板/
    1=$plugin.my_contacts.view.templaterootpath_
    }
    
    部分根路径{
    0=ext:my_联系人/资源/私人/部分/
    1=$plugin.my_contacts.view.partialrootpath_
    }
    
    布局根路径{
    0=ext:my_联系人/资源/私人/版面/
    1=$plugin.my_contacts.view.layoutrootpath_
    }
    }
    
    设置{
    cssfile=$plugin.my_contacts.settings.cssfile_
    }
    }
    

    constants.txt.

    plugin.my_contacts{
    视图{
    #cat=plugin.my_contacts/file;type=string;label=template root(fe)路径
    templaterootpath=ext:my_contacts/resources/private/templates/
    #cat=plugin.my_contacts/file;type=string;label=template partials(fe)的路径
    partialrootpath=ext:my_contacts/resources/private/partials/
    #cat=plugin.my_contacts/file;type=string;label=template layouts(fe)路径
    layoutrootpath=ext:my_contacts/resources/private/layouts/
    }
    
    设置{
    #cat=plugin.my_contacts/file;type=string;label=css文件路径
    cssfile=ext:my_contacts/resources/public/css/news-basic.css
    }
    }
    

    内容过去很简单,但在这个阶段,我从newsplugin复制了它们,所以现在它有更多的设置,但是当我检查模板分析器或尝试访问vew/controller中的设置时,我看不到这些条目。另外,当我尝试重写页面中模板内容中的模板路径时,也不会在那里发生任何事情。

    插件模板本身被识别和读取,我只是无法让它们被覆盖(或从安装程序读取设置)。

    我读了很多例子,但找不到我缺少的东西,所以任何提示都是正确的。

    另外,我已经清除了所有系统缓存和自动加载信息,以防万一。没有帮助。

    我添加了静态文件include insys_template.php:

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

    包含setup.txtconstants.txt:

    enter image description here

    如您所见,我也在静态中添加了它。

    设置.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}
        }
    }
    

    常量.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
        }
    }
    

    内容过去很简单,但在这个阶段,我从news插件,所以它现在有更多的设置,但当我检查模板分析器或尝试访问vew/controller中的设置时,我看不到这些条目。另外,当我尝试重写页面中模板内容中的模板路径时,也不会在那里发生任何事情。

    插件模板本身被识别和读取,我只是不能让它们被重写。(或从设置中读取设置)

    enter image description here

    我读了很多例子,但找不到我缺少的东西,所以任何提示都是正确的。

    另外,我已经清除了所有系统缓存和自动加载信息,以防万一。没有帮助。

    2 回复  |  直到 7 年前
        1
  •  3
  •   Paul Beck    7 年前

    现在,您已经注册了用于typoscript模板的静态typoscript。请使用后端的“模板”模块选择您的打字脚本模板,然后转到“编辑整个模板记录”。在“includes”上,您现在可以看到所有注册了静态类型脚本的扩展,比如扩展,并将它们包含到当前模板中。(请参见下面的屏幕截图)。

    在后端模块中,转到“编辑整个模板记录”。在“includes”上,您现在可以看到所有注册了静态类型脚本的扩展,比如扩展,并将它们包含到当前模板中。(请参见下面的屏幕截图)。

    enter image description here enter image description here

        2
  •  1
  •   Thomas Löffler    7 年前

    您是否在typoscript模板中包含静态模板?

    1. 打开typo3后端
    2. 头到模块“模板”
    3. 选择您的主页
    4. 在顶部的选择框中选择信息/编辑
    5. 点击底部按钮“编辑整个模板记录”
    6. head to tab“包括”
    7. “包括静态(从扩展名)”并选择您的打字脚本。在您的情况下,它应该标题为“主模板(我的联系人)”。
    推荐文章