Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 8
    i think it's absurd that i can't just retrieve media path in .phtml directly. Commented Feb 17, 2017 at 9:37
  • 1
    @LucScu it might be discouraged, for sure. Probably not the best idea to reference an asset that has been uploaded and is not part of the codebase. It feels a bit nasty doing so. Commented Dec 28, 2018 at 7:58
  • 1
    @LucScu it is absurd. Just use the object manager. There is no benefit of using the convoluted 'best' way just to get a url... This is the real world not 'best practice' world. 'Best practices' that Magento doesn't even follow lol. My goodness Magento really is trash I hate it so much 😑 Commented Feb 11, 2021 at 10:23
  • @00-BBB thats actually a wrong statement. Magento2 uses a lot of modern code styles, keeps many aspects in respect, whatsoever. Using of the Object Manager is by far the worst idea one can make - and besides that, the real coding world perfectly fits into "best practice"-approaches, if handled properly. That said, Magento2 overall is still not good - but for a lot of other reasons. Commented Apr 23, 2022 at 22:35