I'm using Laravel and Blade on a small project and am trying to dynamically assign class names to generated elements in a for loop. However, the generated elements are generating literally, such as "<div class='form_q' .$i>
".
@for($i = 0; $i < count($formdata['form2']); $i++)
<div class='form_q'.$i>
HTML::attributes('class')
<div class='q'.$i.'-header'>
<h1>{{ Form::label($formdata['form2']['q'.($i + 1)]['question'], $formdata['form2']['q'.($i + 1)]['type'], array('class' => 'btn btn-primary'))}}</h1>
</div>
</div>
@endfor
What's the proper syntax for concatenating a string and variable and assigning it to an class/attribute? Alternatively, what is the proper Blade syntax for generating a "div" element with an assigned class?