Giter VIP home page Giter VIP logo

Comments (5)

borm avatar borm commented on May 30, 2024 2

Okey, i understand
But, what about the same files name?

  • admin
    • partials
      • header.twig
  • site
    • partials
      • header.twig
$app->register(new \Slim\Views\Twig(['./themes/site','./themes/admin'],[....]

$view->getLoader()->addPath('./themes/admin','admin');
{% include '@admin/partials/header.twig' %}

yes?

from twig-view.

borm avatar borm commented on May 30, 2024 1

@erdemece
$this->view->render($res, '@admin/home.twig', []);

from twig-view.

akrabat avatar akrabat commented on May 30, 2024

I would expect this:

$app->register(new \Slim\Views\Twig('path/to/templates', [
    'cache' => false,
    'debug' => true,
]));

$app->get('foo/bar', function ($request, $response, $args) {
    return $this['view']->render($response, 'foo/bar.twig');
});

To render the template: path/to/templates/foo/bar.twig.

alternatively, if you have multiple top level template directories, you can pass an array as the first parameter to \Slim\Views\Twig like this:

$app->register(new \Slim\Views\Twig(['path/to/templates1', 'path/to/templates2'], [
        'cache' => false,
        'debug' => true,
]));

from twig-view.

borm avatar borm commented on May 30, 2024

Hove use it?

from twig-view.

erdemece avatar erdemece commented on May 30, 2024

@borm how do you use this in view->render ?

from twig-view.

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.