7

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> 
  • show code for your block – Rakesh Jesadiya Jun 15 '16 at 10:47
  • see my code @Rakesh – mr. max Jun 15 '16 at 11:04
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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