@component('share.header.zt_topbar2')@endcomponent @include('share.header.zt_nav2')
Both methods above can be introduced laravel view templates or assembly
But little difference
if the definition of the variables used in the video, when imported using the component method can not be used.
And this may take a value in a common template is introduced in the process include the.
Such as
Public templates or components
<div id="common-nav"> <div class="cc"> <a href="{{ config('const.commonUrl.top') }}" target="_blank"><div class="common-logo"></div></a> <ul class="nav-c"> <li class="{{ ($page ?? '') == 'bs' ? 'active' : '' }}"><a href="{{ config('const.commonUrl.bs') }}" onclick="{{ $page ?? '' == 'bs' ? 'return false;' : '' }}" target="_blank">教资笔试</a></li> <li class="{{ ($page ?? '') == 'ms' ? 'active' : '' }}"><a href="{{ config('const.commonUrl.ms') }}" onclick="{{ $page ?? '' == 'ms' ? 'return false;' : '' }}" target="_blank">教资面试</a></li> <li class="{{ ($page ?? '') == 'zk' ? 'active' : '' }}"><a href="{{ config('const.commonUrl.zk') }}" onclick="{{ $page ?? '' == 'zk' ? 'return false;' : '' }}" target="_blank">教师招聘</a></li> <li class="{{ ($page ?? '') == 'pth' ? 'active' : '' }}"><a href="{{ config('const.commonUrl.pth') }}" onclick="{{ $page ?? '' == 'pth' ? 'return false;' : '' }}" target="_blank">普通话考证</a></li> </ul> <div class="common-tel"></div> </div> </div>
You need to use view
<?php $page = 'zk'; ?> @include ( 'share.header.zt_nav2') // $ page at this time there is value in the template inside
and
@component('share.header.zt_topbar2')@endcomponent // $ page which fail to value