Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

->render() not evaluating Blade syntax #26

Open
qrazi opened this issue Jan 6, 2016 · 0 comments
Open

->render() not evaluating Blade syntax #26

qrazi opened this issue Jan 6, 2016 · 0 comments

Comments

@qrazi
Copy link

qrazi commented Jan 6, 2016

I could not find an existing issue, and I could not find that I'm using incorrect syntax. When I want to have a template rendered manually to output, in this case for an Ajax-request, I would assume the following would work:

$content = view('name-of-template')->render();

It does however not evaluate Blade-syntax like {{ 'Foo' }}. The $content contains the literal string {{ 'Foo' }}.

I did use a hacky way to get it rendered properly:

$model = \WP_Blade_Main_Model::make();
$absolute_path = get_template_directory().'/name-of-template.php';
$rendered_path = $model->template_include_blade($absolute_path);
include($rendered_path);

This seems however not exactly the best approach. Am I right in assuming ->render() should work in this situation?

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

No branches or pull requests

1 participant