12

What is replacement function for getting the skinurl in magento-2. In magento-1 we use $this->getSkinUrl() and {{skin url=''}} to get skin url.

0

1 Answer 1

36

in magento 1

$this->getSkinUrl()

Replace with in magento2

$block->getViewFileUrl()

in magento 1

{{skin url=''}}

Replace with in magento2

{{view url=''}}

Reference

2
  • Does not explain how to fetch it from inside a template used by any block type
    – OZZIE
    Jul 26, 2016 at 13:06
  • @OZZIE every block file extends from Magento\Framework\View\Element\Template that extends with Magento\Framework\View\Element\AbstractBlock.php. you can on line 762 you can this method getViewFileUrl Jul 26, 2016 at 13:39

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.