mercredi 27 avril 2016

having trouble including php code in blade

I have some header code that I don't want in the controller and I just want it in the view, but because of php tags around the code I don't know how would I work this within the blade,

I have something like this

links.blade.php

 $links = array(
    'tab1'=>array('_'=>'a', 'href'=>'link1', 'link1'),
    'tab2'=>array('_'=>'a', 'href'=>'link2', 'link2'),
    'tab3'=>array('_'=>'a', 'href'=>'link3', 'link3'),
    'tab4'=>array('_'=>'a', 'href'=>'link4', 'link4'),
    );
?>

header.blade.php

<?php
switch () {
//other header code

@include('links')  //id like to include it here

//other header code
}

?>

how would I include links.blade.php array or a variable into header.blade.php ? Or do I have to create the controller in order to do this ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire