php inside html indent style
The second one is definitely better. In the first one, it's really hard to see that the div is actually inside the if. 

Personally, I would build the string completely in PHP, and then echo it, instead of switching in and out of the HTML context. This will avoid the opening and closing PHP tags being littered around your code:

$html = "";
if ($this-&gt;product-&gt;getType() == Product_Types::BOOK) {
    $html += "&lt;div&gt;" . $this-&gt;product-&gt;getAuthor() . "&lt;/div&gt;";
}
echo $html;