i using blade echo inside of stylesheet reference in header section. specifying css skin site.
the original line is:
<link href="{{ asset("/dist/css/skins/skin-default.min.css"}}" rel="stylesheet" type="text/css\" />
i grabbing skin setting per user , want insert line change user wants skin. have setting pulled out variable within view service provider.
$view->with('visualskin', auth::user()->visualskin);
this way have $visualskin set when views rendered.
how can insert asset href above , default setting if user has none set?
i can call variable or set default doing:
{{ $visualskin or "skin-default" }}
however, how can inline section asset href? not work:
<link href="{{ asset("/dist/css/skins/{{ $visualskin or "skin-red-trim" }}.min.css"}}" rel="stylesheet" type="text/css\" />
i've tried php trickery, since it's blade formatting when inserting php echo, doesn't rendered blade process.
can nest blade echos?
missing character escaping?
you don't need nesting! inside blade tags, php running, can concatenate strings naturally.
<link href="{{ asset("/dist/css/skins/" . $visualskin or "skin-red-trim" . ".min.css")}}" rel="stylesheet" type="text/css\" />
note missing )
close asset(
function.
using {{ 'something' }}
same type: echo 'something'
so can echo, can on blade echo tags.
Comments
Post a Comment