【问题标题】:Creating ViewHelpers inside Typo3 fluid template在 Typo3 流体模板中创建 ViewHelpers
【发布时间】:2013-03-16 03:52:12
【问题描述】:

我想使用 Fluid 从头开始​​构建 Typo3 模板。我是这个 CMS 的新手,但对使用类似 MVC 方法的 Zend Framework 有一定的了解。我不知道将 ViewHelpers 放在我的模板中的什么位置。

我的目录结构如下:

typo3/fileadmin/
    projectname/
        templates/
            assets/
                images
                js
                styles/
                    css/
                    less/
            layouts/
                single.html
                2col.html
                3col.html
            partials/
                breadcrumb.html
            default.html
        tsconfig/
        typoscript/
            constants.ts
            setup.ts  

我在网上找到的都是在 Typo3 扩展中使用 Fluid 的教程。我想为我的类注册一个新的命名空间,为自动加载器定义一个目录,并在我的模板中使用 viewhelpers,而不是在扩展中(例如<my:formatMyWay>

模板中有类似的东西吗?还是我必须为此创建自己的 Typo3 扩展?

【问题讨论】:

    标签: typo3 fluid typo3-flow


    【解决方案1】:

    您说得对,您必须创建自己的 TYPO3 扩展程序才能拥有自己的视图助手。您可以使用extension_builder 启动一个空扩展。然后在typo3conf/ext/my_ext/Classes/ViewHelpers/ 下添加您的viewhelper,并将此命名空间添加到模板的顶部:{namespace my=Tx_MyExt_ViewHelpers}This simple guide 也可以帮助您创建 viewhelper 本身。一个优点是您可以很好地打包 viewhelper 并在多个项目中使用它们。

    【讨论】:

    • 嗨@Pascal。非常感谢您的帮助和澄清!
    猜你喜欢
    • 2018-10-28
    • 2021-09-01
    • 2016-01-03
    • 1970-01-01
    • 2017-04-10
    • 2013-08-31
    • 1970-01-01
    • 2013-07-26
    • 1970-01-01
    相关资源
    最近更新 更多