lundi 20 novembre 2017

how to highlight string in a string in a laravel blade view

Somewhere in my template I have this:



Now in this text I want to highlight all words that are in the string



So I thought I create a new blade directive:



Blade::directive('highlightSearch', function($input, $searchString)...

error: missing argument 2

Found out that directives do not except 2 arguments. I tried every workaround that I could find but none worked. They always return the arguments as a plain string, not even passing the actual values.

I tried adding a helper function like explained here: http://ift.tt/2zXcYGl. Did not work:

error: unknown function "highlightSearch"

So how do I do this super easy task in laravel? I don't care about the highlighting function, that's almost a one-liner.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire