2

I have a problem with the magento cms. The perfect solution would be to have widgets nested in another widgets (similar approach like TYPO3 FCEs). I've got a lot of problems with escaping, editing and saving this deeply nested structure. Is there a better way to accomplish this? What I actually want is to create elements with a certain html frame with the possibility to insert another elements of the similar kind. You can think about it as of bootstrap elements, where I want something like row-element containing col-elements containing other elements. I know, that it can be done with static blocks, but the usability is quite poor.

Would appreciate any ideas or suggestions!

2
  • what about using static blocks with js ans css enabled. you can put any css rules for a static block and make out desired result. Checkout github.com/progammer-rkt/magento-js-css-for-static-blocks Commented Aug 28, 2014 at 9:22
  • @programmer_rkt for a developer it's not a problem at all, but you cannot give such low-level tool to a customer without having doubts that he will call you 5 minutes later an say that the whole layout is broken :-) And you still have a problem of nesting these blocks and having to switch the scope all the time until you have the structure you want to.
    – mryvlin
    Commented Aug 28, 2014 at 11:03

1 Answer 1

1

Haven't tested this but if you have a widget that loads a static block you could add another widget in that static block again and so on. Basically having widget-ception.

It would, I guess, look something like this:

class[Namespace]_[Module]_Block_Widget
   extends Mage_Core_Block_Template
      implements Mage_Widget_Block_Interface
{
    protected $_serializer = null;

    protected function _construct()
    {
        $this->_serializer = new Varien_Object();
        parent::_construct();
    }

    /**
     * Produce links list rendered as html
     *
     * @return string
     */
    protected function _toHtml()
    {
        $staticBlockId = $this->getData('static_block_id');

        return $this->getLayout()->createBlock('cms/block')->setBlockId($staticBlockId)->toHtml()
    }
}
1
  • Yes, it was my initial idea, too. But if you want to create a row with four columns and content inside them, you have to go back and forth between the page and cms blocks all the time. I would want to have something where you can ideally create and edit everything at once.
    – mryvlin
    Commented Aug 28, 2014 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.