tapestry-cloud / tapestry

PHP static site generator using the plates template system
https://www.tapestry.cloud/
MIT License
32 stars 1 forks source link

$this->getUrl() on null when used from a template #158

Closed carbontwelve closed 7 years ago

carbontwelve commented 7 years ago

When executing the helper $this->getUrl() from a inherited (extended) template file Tapestry errors because the helper requires a File be set that doesn't exist.

The template calling the parent should pass its File during the call so that any File based helper within the extended template gets called on the original File.

This does raise a question of which File should be passed if there is a chain of inheritance, this is to be defined as the initiator of chain File, e.g: blog.md -> _views/blog -> _templates/default, the File common to all should be blog.md.

A good place to begin looking is the $this->layout method.

carbontwelve commented 7 years ago

This was caused when a template extended another via the this->layout method resulting in the default render method getting executed without the File getting passed along.

This is fixed by d0709ea67298bab5235644a3056ea2f369a22dfa