Jimport

jimport is a function that is used to include Joomla library files.

How to use Jimport:

  1. Find the path to the library file you want to include.

    • In our testing, we want to import /libraries/joomla/filesystem/path.php
    • Jimport will only import files found within the libraries folder.

  2. Make the following changes to the path:

    • Remove /libraries/ from the path
    • Remove .php from the path
    • Replace slashes with periods in the path

    After following the steps above, /libraries/joomla/filesystem/path.php will be:

    joomla.filesystem.path

  3. Take this new path and pass it to jimport, as in:

    jimport(‘joomla.filesystem.path‘);

If you followed along with the above example, you can see in the screenshot below how jimport works:

jimport in action

Was this article helpful? Join the conversation!