Slider Revolution magento extension FAQ

How to insert Slider Revolution programmatically

You can insert Slider Revolution to Magento store programmatically by adding it to layout or generating and outputting its code in controller action or block.

For example in controller action you can use following code:

$this->loadLayout();
$myBlock = $this->getLayout()
    ->createBlock('revslider/revslider')
    ->setAlias('homepage');

This will create Slider Revolution block, now you can render it to html string to output it somewhere:

$myHtml =  $myBlock->toHtml();

Or add it to layout:

$this->getLayout()
    ->getBlock('content')
    ->append($myBlock);
//Now showing it with rendering of layout
$this->renderLayout();

To do it in your block class:

$myBlock = $this->getLayout()
    ->createBlock('revslider/revslider')
    ->setAlias('homepage');

And then add it to block’s children:

$this->setChild('revslider', $myBlock);

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *