4

I noticed that you can set the page title in the layout xml per how to modify page title.

but it's not working in the admin - if I want to change the admin page title, in the Controller, this works:

$resultPage->getConfig()->getTitle()->prepend(__('Customers Now Online'));

Is there a way to set the result content page title in the layout xml?

2

Add this in Block file which is associated to phtml file.

 public function getHeader()
        {
            if ($this->getProduct()->getId()) {
                $header = $this->escapeHtml($this->getProduct()->getName());
            } else {
                $header = __('New Product');
            }
            return $header;
        }

Change this function as your requirement. Also header need to declare into xml file.

1

SET PAGE TITLE VIA LAYOUT XML

Open your xml file inside your layout folder and place this code above the body tag.

<head>
    <title>SAMPLE TITLE</title>
</head>
  • Sorry @S H Patel - I didn't mean the html page title, but the content page title - I've clarified in the question. – dbcn Dec 13 '16 at 17:43

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.