6

I have created a static block programmatically on homepage. but it shows after the heading title. i want to set position for it. enter image description here

I want this New Block block between Registered Customer and New Customer blocks. anyone help me how can i do this programmatically?

code for this:
in layout :

<block class="Magento\Customer\Block\Form\Newblock" name="customer.newblock" template="form/newblock.phtml"/>

In block:

 <?php
 namespace Magento\Customer\Block\Form;
class Newblock
   extends \Magento\Framework\View\Element\Template
{
   public function getTitle()
  {
      return "New Block";
  }
}

In templates :

   <h1><?php echo $block->getTitle(); ?></h1> 
2
  • show code for your block Jun 15, 2016 at 10:47
  • see my code @Rakesh
    – mr. max
    Jun 15, 2016 at 11:04

1 Answer 1

6

You can set your xml like this,

<block class="Magento\Customer\Block\Form\Newblock" name="customer.newblock" template="form/newblock.phtml" after="customer_form_login"/>

Remove cache and check your block position.

0

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.