Are you taking the result of the view and then using that as a template?
I ask because if I understand,
$article->html = '<b>test @myCustomDirective('test')</b>'
The directive is not executed.
What are you trying to do?
Yes that's it. The directive is not executed, {!! $article->html !!} print me : test @myCustomDirective('test')
You put the directive in the template,
{{ @myCustomDirective ('test') }}
This will run the directive, passing the variable of test to it.
I would like to create directive such as "html" tag, that's mean :
$article->html contains my html data from my wyswyg which implements some new html tag, like @ipcodes('specific ip category name') displaying the ipcode of the parameter.
Ok,
Then you will need to either save the $article->html to a temp file then use that as a template for blade or you can use my StringBladeCompiler class which lets you use a string as a template.
If your using Laravel 5.1+, it would be something like this
// store the original $article->html in the db, so that it can be edited with the blade directives
// otherwise you will lose the @ipcodes from the text
// update the value to display
$html = View($article->html, [] );
The $html var should contain the processed result of the blade directives. You might need to setup the directives slightly different, but it shouldn't be much of a problem.
It is a little more code if your still using Laravel 4.2. and 5.0
Take a look at the GitHub for the project, https://github.com/TerrePorter/StringBladeCompiler and find the right branch for your version of Laravel.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community