2

Magento version:2.0.0

How to get the theme url in the phtml file? there has a global function for it?

2 Answers 2

4

If you're looking for a replacement of $this->getSkinUrl() from Magento 1 then the equivalent in Magento 2 is the following:

$block->getViewFileUrl()
0

What do you mean by theme url? What aspect of the theme? E.g skin, template, base URL etc.

If you want the skin URL then Raphael's answer is correct, if you want the template URL it is:

$block->getTemplateFile('module_name::template-name.phtml'))

To get the base url:

$this->getBaseUrl()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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