/ Published in: PHP

Just an example showing how to minimise the mixture of HTML and PHP in a view.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<? foreach($products as $product): ?> <article class="product"> <div class="innercontainer"> <div class="post-header"> <div class="entry-thumb"> <img src="<?=base_url('assets/uploads/product_images/'.$product->image)?>" width="270" height="180"> </div> <a class="entry-link more-link" href="<?=base_url('shop/'.$shop->url.'/product_id/'.$product->id)?>">See this Item</a> </div> <header class="entry-header"> <h2><a href="<?=base_url('shop/'.$shop->id.'/product/'.$product->id)?>"><?=$product->name?></a></h2> <p><?=truncate($product->description, true)?></p> </header> <div class="entry-content"> <ul class="post-meta"> <li><span class="price-tag">£<?=$product->price?></span></li> <li>Category: <a href="#"><?=$product->category?></a></li> </ul> </div> <footer class="entry-footer"> </footer> </div> </article> <? endforeach; ?>
Comments
