0

I want to build a Typo3 template from scratch using Fluid. I'm new to this CMS, but have knowledge in Zend Framework which uses a similar MVC approach. What I don't know is where to put the ViewHelpers inside my template.

I have the following directory structure:

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  

All I found on the web were tutorials using Fluid inside a Typo3 extension. I'd like to register a new namespace for my classes, define a directory for the autoloader and use the viewhelpers inside my templates and not inside an extension (e.g. <my:formatMyWay>)

Is there something similar inside the templates? Or do I have to create my own Typo3 extension for this?

1 Answer 1

1

You're right, you have to create your own TYPO3 extension in order to have own viewhelpers. You can use the extension_builder to kickstart an empty extension. Then add your viewhelper under typo3conf/ext/my_ext/Classes/ViewHelpers/ and add this namespace to the top of your template: {namespace my=Tx_MyExt_ViewHelpers}. This simple guide may also help you to create the viewhelper itself. An advantage is that you can nicely package the viewhelpers and use them in multiple projects.

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

Comments

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.