I want to transform this code for laravel blade template <?php echo ($page=="menu" ? "header-active" : "")?>
i have code in Php to make header menu.
<ul class = "menu-container">
<li class="header-hover <?php echo ($page=="home" ? "header-active" : "")?>">
<a href="{{URL::to('/')}}"><div class="menu">HOME</div></a> </li>
<li class="header-hover <?php echo ($page=="menu2" ? "header-active" : "")?>">
<div class="menu">Menu 2</div>
<ul class="in">
<li><a href="{{URL::to('/menu2 A')}}">MENU 2A</div></a> </li>
</ul>
</li>
</ul>
Please Help me I get error : Undefined variable: page
Try the following -{!!$page=="layanan" ? "header-active" : ""!!}
.
Before that, make sure you have installed laravelcollective/html
If not, Follow the below steps,
"laravelcollective/html": "5.1.*"
in the require feild inside composer.json file in the root of the project.composer update
from root of your project. This will install the package required for blade templating by laravel.providers
add Collective\Html\HtmlServiceProvider::class
.aliases
add 'Form'=>Collective\Html\FormFacade::class
and 'Html'=>Collective\Html\HtmlFacade::class
.Thankyou :)