title: Adding YouTube video to product and CMS pages Magento
body: <p>I've created a custom attribute in my Magento store in order to show youtube videos by adding the video id in to a text field.</p>
  
  <p>I've placed this code in <code>video.phtml</code> which is in <code>catalog/product/view</code> folder </p>
  
  <pre><code>&lt;p&gt;
  &lt;?php $attStuff= $_product-&gt;getData(); ?&gt;
  &lt;?php if( !empty( $attStuff['videoid'] ) ): ?&gt;
  &lt;iframe width="330" height="253" src="http://www.youtube.com/embed/&lt;?php echo $attStuff['videoid']; ?&gt;" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
  &lt;?php endif; ?&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>I now wish to have the video show in the right sidebar of a CMS page and have added a layout update referencing <code>video.phtml</code>:</p>
  
  <pre><code> &lt;reference name="right"&gt; 
   &lt;block type="core/template" name="catalog.product.video"   template="catalog/product/view/video.phtml" /&gt; 
    &lt;/reference&gt;
  </code></pre>
  
  <p>I now get the following error: </p>
  
  <blockquote>
    <p>Fatal error: Call to a member function getData() on a non-object in /Applications/MAMP/htdocs/mysite/app/design/frontend/bootstrapped/default/template/catalog/product/view/video.phtml on line 13</p>
  </blockquote>
  
  <p>and I can't diagnose the problem!</p>
  
  <p>Any ideas as to what might be the problem here?</p>