Mohammad Aghayari
Mohammad Aghayari

Reputation: 1160

How to use html tag for div, without ending div

In this code I can just write separate div in every Html::tag('div') that as you know every Html::tag('div') means <div></div> .

But I want to put a couple div inside an specific div. bellow code could help you to understand it well.

$item[] = [
   'content' => [
           Html::tag('div', 'begin my div here',
               ['class' => 'background_white'] ), //<div class="background_white"> begin my div
           Html::tag('div', 'center'),
           Html::tag('div', 'end my div here,) //  end div my here </div>
   ]
];

Upvotes: 1

Views: 1115

Answers (2)

Yasin Patel
Yasin Patel

Reputation: 5731

1) div inside another div

     $body[] = Html::tag('div','body',['class'=>'panel-body']);
     echo Html::tag('div',implode($body),['class'=>'panel panel-primary']);

2) two div inside one div

     $head[] = Html::tag('div','heading',['class'=>'panel-heading']);
     $body[] = Html::tag('div','body',['class'=>'panel-body']);
     echo Html::tag('div',implode($head).implode($body),['class'=>'panel panel-primary']);

Upvotes: 2

Master DJon
Master DJon

Reputation: 1965

You could probably try this :

$item[] = [
   'content' => [
           Html::tag('div', 'begin my div here' . Html::tag('div', 'center'),
               ['class' => 'background_white'] )
   ]
];

You could also look at beginTag and endTag.

Upvotes: 2

Related Questions