Skip to content

Instantly share code, notes, and snippets.

@monsat
Created February 29, 2012 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monsat/1939348 to your computer and use it in GitHub Desktop.
Save monsat/1939348 to your computer and use it in GitHub Desktop.
Side Bar View Block in view template
// app/View/Common/sidebar-page.ctp
<div class="primary">
<div class="primary-content">
<?php echo $this->fetch('content'); ?>
</div>
</div>
<div class="sidebar">
<?php if ($this->fetch('related')): ?>
<div class="related">
<h3>Related content</h3>
<?php echo $this->fetch('related')); ?>
</div>
<?php endif; ?>
</div>
// app/View/Product/view.ctp
<?php $this->extend('Common/sidebar-page'); ?>
<?php $this->start('related'); ?>
<p>Other items related to <?php echo h($product['Product']['name']); ?>:</p>
<?php echo $this->element('product/related', array('related' => $product['RelatedProducts']));
<?php $this->end(); ?>
<h1><?php echo h($product['Product']['description']); ?></h1>
// More product details below.
@monsat
Copy link
Author

monsat commented Mar 2, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment