Created
April 17, 2015 19:36
-
-
Save sajadtorkamani/cf5615e43af3c1a64550 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CONTROLLER: Stores retrieved product fields into a F3 array variable 'products'; | |
public function index() | |
{ | |
$this->f3->set('products', $this->db->exec("SELECT * FROM products LIMIT 5")); | |
$this->f3->set("page_title", "Homepage"); | |
$this->f3->set("page_id", "home"); | |
$this->f3->set('view','app/views/user/home.htm'); | |
} | |
// VIEW: Traverses through the F3 array variable 'products' and displays its fields in the view template. | |
<ul> | |
<repeat group="{{ @products }}" value="{{ @product }}"> | |
<li> | |
<a href="{{ @BASE }}/product/{{ @product.productID }}/{{ @product.name }}" class="product-thumbnail"> | |
<img src="{{ @IMAGEPATH }}{{ @product.thumb_image }}" alt="{{ @product.name }}"> | |
<button class="view" title="View image"> | |
<a href="{{ @IMAGEPATH }}{{ @product.full_image }}">Hover</a> | |
</button> | |
</a> | |
<a href="{{ @BASE }}/product/{{ @product.productID }}/{{ @product.name }}" class="product-name">{{ @product.name }}</a> | |
<span class="product-price">£{{ @product.price }}</span> | |
<span class="product-price"></span> | |
</li> | |
</repeat> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment