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

CUSTOM Directive Does NOT Work WITH PHP #59

Open
mahmoudmohamedramadan opened this issue Jun 10, 2021 · 3 comments
Open

CUSTOM Directive Does NOT Work WITH PHP #59

mahmoudmohamedramadan opened this issue Jun 10, 2021 · 3 comments

Comments

@mahmoudmohamedramadan
Copy link

When I run this code the custom directive does NOT rendered successfully

require_once dirname(__FILE__, 3) . '/vendor/autoload.php';

use Jenssegers\Blade\Blade;

$viewFolderPath = dirname(__FILE__, 3) . '/app/Blade/views';

$blade = new Blade($viewFolderPath, 'cache');

echo $blade->directive('php', function () {
    return "<?php echo 'Welcome; ?>'";
});

and inside home.blade.php

@php

BUT the output be @php NOT Welcome as expected

@QWp6t
Copy link

QWp6t commented Jun 10, 2021

image

@mahmoudmohamedramadan
Copy link
Author

also when rendering, print out @custom

blade

@xy2z
Copy link

xy2z commented Nov 19, 2021

also when rendering, print out @custom

blade

I just tested the code and it works for me.

From the left picture it looks like you added the directive at the end of the index.php file, you have to make sure to add the directive before you make/render the views.

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

3 participants