Skip to content

Add namespace loader - #320

Open
alexander-schranz wants to merge 5 commits into
nette:masterfrom
alexander-schranz:feature/namespace-loader
Open

alexander-schranz wants to merge 5 commits into
nette:masterfrom
alexander-schranz:feature/namespace-loader

Conversation

@alexander-schranz

Copy link
Copy Markdown

This introduce a namespace loader. This allows to use a namespace like app:: similar to Plates and Blade template engine.

Usage:

    $defaultLoader = new FileLoader(__DIR__ . '/templates');
    $emailLoader = new FileLoader(__DIR__ . '/emails');
    $someLoader = new FileLoader(__DIR__ . '/vendor/some/some/templates');
    $otherLoader = new StringLoader(['main' => 'othercontent']);

    $loader = new NamespaceLoader([
        '' => $defaultLoader,
        'email' => $emailLoader,
        'some' => $someLoader,
        'other' => $otherLoader,
    ]);

This way it is very flexible as we can use any loader again.

@alexander-schranz
alexander-schranz force-pushed the feature/namespace-loader branch 2 times, most recently from 91639ac to d8ea450 Compare November 1, 2022 15:57
@alexander-schranz alexander-schranz changed the title Feature/namespace loader Add namespace loader Nov 1, 2022
@alexander-schranz

alexander-schranz commented Nov 5, 2022 •

Copy link
Copy Markdown
Author

@dg looks like you rebased it. Do I need to change the target branch?

Edit: Oh my fault looks like the master was force pushed to another state. I will rebase my branch.

@dg
dg force-pushed the master branch 7 times, most recently from 0204a35 to 8976643 Compare January 21, 2023 22:02
@dg
dg force-pushed the master branch 12 times, most recently from d089915 to 7886af0 Compare February 1, 2023 04:44
@dg
dg force-pushed the master branch 3 times, most recently from 5bc5e58 to 7c835a1 Compare February 11, 2023 14:21
@dg
dg force-pushed the master branch 2 times, most recently from 22ef9ab to 3d028e6 Compare March 1, 2023 08:24
@dg
dg force-pushed the master branch 2 times, most recently from 0b3fbaa to 6f66dcf Compare March 9, 2023 01:35
@dg
dg force-pushed the master branch 2 times, most recently from 540aeb9 to dbd49d4 Compare August 6, 2023 23:52
@Crell

Crell commented Jul 19, 2024

Copy link
Copy Markdown

It looks like @dg has been rebasing this diligently for 2 years. I am also very interested in this feature (the thing I'm trying to do right now likely won't really work without it), as currently there seems to be no way to reference a layout that is not in the same directory as the template, or else have relative paths defined in the {layout} block (ew).

Is there something we users could do to help move this forward, or get attention on it?

@dg

dg commented Oct 28, 2026

Copy link
Copy Markdown
Member

A loader with namespaces is in preparation in a branch of mine; I'll let you know here when it's out. Thanks for the PR and for your patience with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants