Return to Snippet

Revision: 59451
at September 9, 2012 00:10 by JonnySnip3r


Initial Code
<? 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>
        <?=(!empty($product->options))?'<li>Options: '.$product->options.'</li>':''?>
      </ul>
    </div>
    <footer class="entry-footer">
      <time class="datetime" datetime="<?=$product->date?>"><?=humanise_the_date($product->date)?></time>
    </footer>
  </div>
</article>
<? endforeach; ?>

Initial URL

                                

Initial Description
Just an example showing how to minimise the mixture of HTML and PHP in a view.

Initial Title
Codeigniter View Example

Initial Tags
php, codeigniter

Initial Language
PHP