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.

up vote 29 down vote accepted

in magento 1

$this->getSkinUrl()

Replace with in magento2

$block->getViewFileUrl()

in magento 1

{{skin url=''}}

Replace with in magento2

{{view url=''}}

Reference

  • Does not explain how to fetch it from inside a template used by any block type – OZZIE Jul 26 '16 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 – Qaisar Satti Jul 26 '16 at 13:39

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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