Giter Site home page Giter Site logo

Comments (4)

smnandre avatar smnandre commented on August 20, 2024

First thing: I'm not sure you should create a Twig component for your entire body.

In your layout.html.twig, you use a block "body" than you never defined... The twig:Body component is a .. component, and the fact it could work calling it body is nothing documented, and that could change at any time.

Is there any reason here that prevent you to use standard twig blocks ?

from ux.

tito10047 avatar tito10047 commented on August 20, 2024

Its not about component Body. Its only simulation of problem. But In my aplication have similar component Layout where I want have logic which layout I want use. So aproach is similar and problem is same.

And why im using components? I want build universal template for all my projects. I think components are suitable for this.

So should I take it as saying that this cannot be done with twig components?

from ux.

smnandre avatar smnandre commented on August 20, 2024

Its not about component Body.

Just saying you have no outer blocks in this template. so this wont work.

<twig:Body>
    {{ block(outerBlocks.body) }}
</twig:Body>

So should I take it as saying that this cannot be done with twig components?

I'm saying this is much easier with twig regular blocks / extends / embeds... Twig is the perfect tool to build layout structures with inheritence, etc... TwigComponents are made to have PHP-based capabilities in an isolated scope.

from ux.

tito10047 avatar tito10047 commented on August 20, 2024

But i like props in twig comnponents. With it I can simply modify the view. I dont need to remmember all classes, just set the props and everything in template is hapening.

But thanks for your time, I will switch to classic blocks

from ux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.