How do you do it?
I just cannot figure out how to write PHP code so that the outputted HTLM would be nicely indented.
This is my usual way of writing PHP in template files (I have created a dummy posts table with some random data):
Which outputs:PHP Code:<div>
<?php foreach ($posts as $post): ?>
<h2><?php echo $post->title; ?></h2>
<?php echo $post->content; ?>
<?php endforeach; ?>
</div>
I would like something nicely indented like this:Code:<div> <h2>Test Post</h2> <p>Some content here...</p><p>Some content here...</p><p>Some content here...</p> <h2>Test Post</h2> <p>Some content here...</p><p>Some content here...</p><p>Some content here...</p> <h2>Test Post</h2> <p>Some content here...</p><p>Some content here...</p><p>Some content here...</p> </div>
Code:<div> <h2>Test Post</h2> <p>Some content here...</p><p>Some content here...</p><p>Some content here...</p> <h2>Test Post</h2> <p>Some content here...</p><p>Some content here...</p><p>Some content here...</p> <h2>Test Post</h2> <p>Some content here...</p><p>Some content here...</p><p>Some content here...</p> </div>






Bookmarks