user180460 user180460 - 1 month ago 13
CSS Question

Syntax error when close div

I have below code in WordPress template:

</header><?php

Better_Mag::generator()->blocks()->menu_main_menu();

Better_Mag::generator()->blocks()->breadcrumb(); ?>

<div class="container"><?php
Better_Mag::generator()->get_main_slider();

?>


and when i want close opened dive like below, it show me syntax error:

</header><?php

Better_Mag::generator()->blocks()->menu_main_menu();

Better_Mag::generator()->blocks()->breadcrumb(); ?>

<div class="container"><?php
Better_Mag::generator()->get_main_slider();
</div>
?>


i want close dive cause i want create bootstrap row like below, but i see syntax error:

</header><?php

Better_Mag::generator()->blocks()->menu_main_menu();

Better_Mag::generator()->blocks()->breadcrumb(); ?>

<div class="container"><?php
<div class="row">
<div class="col-lg-6">
Better_Mag::generator()->get_main_slider();
</div>
<div class="col-lg-6">
hello world
</div>
</div>
</div>
?>

Answer

Try this; You were getting errors because you had raw html within php.

</header><?php

Better_Mag::generator()->blocks()->menu_main_menu();

Better_Mag::generator()->blocks()->breadcrumb(); ?>

<div class="container">
<div class="row">
<div class="col-lg-6">
<?php
Better_Mag::generator()->get_main_slider();
?>
</div>
<div class="col-lg-6">
hello world
</div>
</div>
</div>