2

I changed the subscribe.phtml in

vendor/magento/module-newsletter/view/frontend/templates/subscribe.phtml.

I just changed:

<span><?= $block->escapeHtml(__('Subscribe')) ?></span> 
to
<span>Test</span> 

I cleared everything with :

sudo rm -rf pub/static
sudo rm -rf var/cache
sudo rm -rf var/composer_home
sudo rm -rf var/generation
sudo rm -rf var/page_cache
sudo rm -rf var/view_preprocessed 

and then started php bin/magento setup:static-content:deploy.

But nothing changed. Why ? Please help

0

Please try this solution.

1) Magento way

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$escaper = $objectManager->create('Magento\Framework\Escaper')->escapeHtml(__('Subscribe'));

2) Core Php way

 htmlspecialchars(__('Subscribe'), ENT_COMPAT, 'UTF-8', false);
0

Maybe subscribe.phtml is override by theme or other modules. First, enable template hint and check from where subscribe.phtml Calling.

https://www.mageplaza.com/kb/how-to-enable-template-path-hints-magento-2.html According to template hint modify the template file.

But you don't work directly at the vendor folder. Override via Theme or Module

You can follow https://www.classyllama.com/blog/template-override-m2 for override the templates files location.

  • Yes but theoretically it should work right ? – Make UP May 5 at 11:13
  • And i activated template hints. This is the Path: vendor/magento/module-newsletter/view/frontend/templates/subscribe.phtml So i edited the correct file. I have Redis and Varnish activated. Maybe this is the reason ? – Make UP May 5 at 11:18
  • Yes, you have to flush redis cache – Amit Bera May 6 at 13:26

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.