Code Monkey home page Code Monkey logo

Comments (3)

harikt avatar harikt commented on May 22, 2024

Actually many months back I implemented something https://github.com/cocoframework/Cocoframework.Renderer/blob/master/src/RendererInterface.php#L9 . This was the signature .

render($data, $view, $layout = null);

Not sure if the method can be changed to something similar.

from zend-expressive.

weierophinney avatar weierophinney commented on May 22, 2024

Take a look at the zend-view documentation. I'd argue that layout functionality is something that the individual adapters should address, either by abstracting it, or providing documentation on how to achieve it (which is what I did with the zend-view documentation).

In this case, I'd see the possible approaches:

  • Inject the layout to use during instantiation. This approach means that middleware can safely ignore the concept within middleware.
  • Allow passing the layout as a variable during rendering:
    php $html = $templates->render('blog::entry', [ 'entry' => $entry, 'layout' => 'app::layout']);
  • Combine the above; if no layout is provided when rendering, use the default, if present. (A special value, such as false, null, or a constant value could be used to disable rendering the layout.)

For what it's worth, I'm considering adopting this approach for zend-view as well,as it would abstract the concept of doing a full layout. I'm also definitely considering abstracting the namespace functionality, so that the same namespace notation can be used across any adapter.

from zend-expressive.

weierophinney avatar weierophinney commented on May 22, 2024

@harikt Please see #96 for the zend-view rewrite.

from zend-expressive.

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.