tags:

views:

55

answers:

1

Hi,

We are trying to make all our blocks and pages static so that designer or anyone else can easily change the content or design of the website, however. There is a feature that uses our own custom module. So, the template that we want to make static is calling methods out of our custom block, for example,

 <!--some html code-->
    .....
    <?php $this->helpMeBePartOfCMS(); ?>
    .....
 <!--some html code-->

How do i incorporate these method calls inside cms block or page?

Thank you

+1  A: 

The CMS system makes it easy to include custom blocks (or widgets in Enterprise), but not so easy to make method calls. This is because the templates are never parsed as PHP, so you cannot just include a PHP tag.

Why don't you define a custom block to accomplish this? If that won't work, please provide a little more detail about what you're actually trying to include, so that we can troubleshoot further.

Hope that helps!

Thanks, Joe


Since CMS block templates are not parsed as PHP code, there's no way to inject a call as you are describing. However, all classes descending from Mage_Core_Block_Abstract have the ability to call child and parent blocks. Use one of these methods to do what you are looking for from the block directly:

getParentBlock
getChild
getSortedChildren
Joseph Mastey
Well, we have slider template that displays featured products. The slider template is what we want to be in CMS block, however, this slider template needs to get these featured products by calling method getFeturedProducts() from the custom block. So it would use <?php $this->getFeturedProducts() ?> within and some other php code to. Can there be php code in CMS block or page?
latvian
Thank you Joe for replaying and helping
latvian
Thank you again
latvian