Home >Backend Development >PHP Tutorial >laravel template yeild use
<br/>
Today I encountered a small problem related to templates. Different titles need to be displayed on different pages, and different hyperlinks need to be displayed according to routing.
So, I carefully checked laravel's template usage instructions, and it turned out to be very powerful.
Let’s go directly to my solution.
Define a yeild in the template. When other pages inherit, dynamic content will be passed into this designated area:
<p class="head-tips">@yield('title')</p><p class="jump-to-regist">#获取当前页面路由,判断是否是登陆页面 @if (Request::path()=='login') 没有账号? <a href="{{ url('register') }}">去注册</a>@else 已有账号? <a href="{{ url('login') }}">去登陆</a>@endif
@section('title', '关于我们')
The above is the detailed content of laravel template yeild use. For more information, please follow other related articles on the PHP Chinese website!