Skip to content

Instantly share code, notes, and snippets.

@shadowhand
Created March 3, 2009 18:50
Show Gist options
  • Save shadowhand/73452 to your computer and use it in GitHub Desktop.
Save shadowhand/73452 to your computer and use it in GitHub Desktop.
<?php
public function index($product = NULL)
{
// Load the product
$product = ORM::factory('product', $product);
if ( ! View::is_cached('product_intel_25'))
{
// Cache the product details page
$content = View::factory('product/details')
->bind('product', $product)
->cache('product_intel_25');
}
// Prepare the product prices view
$price = View::factory('product/prices')
->bind('prices', $product_prices);
// Get the prices for this product based on the user preferences
$product_prices = $product->get_prices(user_prefs::get('currency_main'), user_prefs::get('currency_second'));
// Create the non-cached template values
$values = array
(
'price' => $price->render(),
);
// Render the cached content
$this->content = View::render_cache('product_intel_25', $tpl_values);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment