0

in design template i want to define variables to use into html tabs. for example i have two div, parent div is relative and child is absolute. i want to have child smaller than parent.

sample:

{{ WIDTH = 326}}
<div class="win7style" style="margin: 0px auto; {{ WIDTH }}px;">
      <div class="win7style" style="{{ WIDTH - 50 }}px;">

can i define like with that custom variables?

DolDurma
  • 15,753
  • 51
  • 198
  • 377
  • did you try???? what happened when you tried???? what worked? what didn't work? what error you got? – itachi Mar 07 '14 at 05:30
  • @itachi this is only quastion and can i define custom variables into BLADE? – DolDurma Mar 07 '14 at 05:41
  • 1
    hopely useful: http://stackoverflow.com/questions/13002626/laravels-blade-how-can-i-set-variables-in-a-template – egig Mar 07 '14 at 05:53

2 Answers2

1

{{...}} is used in laravel-blade for output php variable. You should not define variable in view. Instead define that in controller.

Manoj Saini
  • 108
  • 4
0

In fact Blade template files are nothing else but usual php files. If you really need to define variables inside the template file, you are free to use plain php code.

<? $width = 326; ?>
<div class="win7style" style="margin: 0px auto; {{ $width }}px;">
      <div class="win7style" style="{{ $width - 50 }}px;">
  • Yes this is it. or you can inject the value when returning the view in your route. the double bracket only echo the data {{ $width }} becomes – KeizerBridge Mar 07 '14 at 14:35