Sometimes I see things like this:
<?php echo $this->getLayout()->createBlock("menupro/menu")->setGroup_id(5)->setTemplate("menupro/menupro.phtml")->toHtml(); ?>
I was wondering whether this is a good practise?
Sometimes I see things like this:
<?php echo $this->getLayout()->createBlock("menupro/menu")->setGroup_id(5)->setTemplate("menupro/menupro.phtml")->toHtml(); ?>
I was wondering whether this is a good practise?
This is a rather subjective question, I personally am all for it. You can make your code a lot more readable. Check out this link: Effects of method chaining
The major drawback is that you must return the object. You may not return any other value as you’re only allowed to return $this.