Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

dynamic partials #140

Open
mohitmayank opened this issue Mar 9, 2016 · 3 comments
Open

dynamic partials #140

mohitmayank opened this issue Mar 9, 2016 · 3 comments

Comments

@mohitmayank
Copy link

unable to include a partial dynamically

{{> (pageTemplate) pageData}}

( ! ) Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Template '(pageTemplate)' not found.' in /<root>/vendor/xamin/handlebars.php/src/Handlebars/Loader/FilesystemLoader.php on line 162
( ! ) InvalidArgumentException: Template '(pageTemplate)' not found. in /<root>/vendor/xamin/handlebars.php/src/Handlebars/Loader/FilesystemLoader.php on line 162

9   0.3201  1989000 Handlebars\Template->render( )  ../Handlebars.php:184
10  0.3230  2042696 Handlebars\Template->_renderInternal( ) ../Template.php:182
11  0.3230  2042744 Handlebars\Template->_partial( )    ../Template.php:243
12  0.3230  2042744 Handlebars\Handlebars->loadPartial( )   ../Template.php:508
13  0.3230  2042744 Handlebars\Loader\FilesystemLoader->load( ) ../Handlebars.php:500
14  0.3230  2042744 Handlebars\Loader\FilesystemLoader->loadFile( ) ../FilesystemLoader.php:84
@everplays
Copy link
Contributor

@mohitmayank you can write your own loader to take care of this or feel free to improve the implementation.

@jjok
Copy link

jjok commented Jun 16, 2016

@everplays Any hints on where this change should be made? Thanks.

@everplays
Copy link
Contributor

@jjok you can implement it via either of these two:

  • start with context and make sure that it returns the content of variable when wrapped with parentheses. Then probably need to make some changes regarding loaders as well.
  • The second option would be to make a new loader which returns the content of variable. For this scenario, you need to access the context from loader.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants