felix Posted October 18, 2014 Share Posted October 18, 2014 There currently is an issue with the "Template Data Providers" Module which prevents variables that are set within the "dataprovider" files (controllers) are accessible in the template later. The module works like this: For every template you create a file that handles fetching and manipulating data (doing "business logic"). The files look like this: <?php class HomePage extends \nw\DataProviders\PageDataProvider { public function populate() { $this->foo = 'bar'; } } foo from there should be available as $foo within the template. This worked until 2.3 but seems to be broken now. The module Hooks to beforePageRender and executes the populate() method where the variables are set: https://github.com/marcostoll/processwire-template-data-providers/blob/master/TemplateDataProviders.module#L147 I tracked down the issue to the core module "PageRender" ( https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/PageRender.module#L305 ) where $page->output(true) is called and creates a fresh copy of the Page object. At this point all variables that were added get lost because they aren't persisted. Any Ideas how to avoid this? Link to comment Share on other sites More sharing options...
owzim Posted November 20, 2014 Share Posted November 20, 2014 Cross post: https://processwire.com/talk/topic/4604-template-data-providers/?p=80541 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now