Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Conversation

@weierophinney
Copy link
Member

Currently, specifying a template name is engine-specific:

  • Plates: error::404 indicates the "error" namespace, 404 template
  • Twig: @error/404.html indicates the "error" namespace, 404 template
  • ZF2: error/404 indicates... the "error/404" template.

This causes issues with re-use and portability. This pull request does the following:

  • Creates a common namespace notation (namespace::template); renderers are expected to munge this to fit their needs.
  • Suggests omitting the filename suffix; renderers MAY choose to add it, if required. (Twig implementation will add a default suffix if none is provided; the suffix may be passed to the constructor.)
  • Implements a custom resolver for the zend-view system to implement namespacing.

@weierophinney weierophinney self-assigned this Aug 25, 2015
@weierophinney weierophinney changed the title Abstract template namespace notation and filesystem suffix [WIP] Abstract template namespace notation and filesystem suffix Aug 26, 2015
@weierophinney weierophinney changed the title [WIP] Abstract template namespace notation and filesystem suffix Abstract template namespace notation and filesystem suffix Aug 26, 2015
- Tests and assets created for each template type.
- Plates ran out of the box.
- Twig updated to use namespacing notation.
- zend-view still in progress
- Creates a NamespacedPathStackResolver implementation, which extends
  the basic TemplatePathStack in order to ensure things like LFI
  security and template streams also work. It segregates paths by
  namespace, and resolves based on the namespace provided with the
  template, falling back to the default namespace if no match is found.
- The ZendView adapter now always composes an AggregateResolver. If an
  alternate resolver is found, it is pushed into an AggregateResolver.
  Additionally, a NamespacedPathStackResolver is always injected at
  priority 0 (lower than default) so that we can push paths to it.
@weierophinney weierophinney merged commit 670df83 into zendframework:master Aug 26, 2015
weierophinney added a commit that referenced this pull request Aug 26, 2015
@weierophinney weierophinney deleted the feature/template-namespacing branch August 26, 2015 04:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant