I'am wondering how to get into Joomla! component the subfolder from the current URL.

Is-there a way to achieve this ?

Thnaks by advance

  • Could you clarify what you mean by the term "subfolder"? It may be that you want one of the path constants which are listed here docs.joomla.org/Constants Nov 2 '20 at 23:25
  • By subfolder, i mean when joomla! is installed in subfolder and so this subfolder appears in the url Nov 3 '20 at 9:13

Use Joomla\CMS\Uri\Uri::root(true). Note it returns the path with leading slash. E.g. if site address is https://example.com/joomla/testing/, this returns /joomla/testing.

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.