Organizing Includes

 

This procedure describes how to use the Organize Includes feature in order for PHP objects created in one file to be called into other files within the project.

Before calling objects into one file, you must first create them in another file.

Note:

Ensure that you save any changes to the file before applying the refactoring feature.

Instructions on how to complete a procedure

To use the Organize Includes feature:

  1. In PHP Explorer view, right-click the file and select Refactor | Organize Includes -or- open the file and press Ctrl+Shift+O.
    An Organize Includes preview dialog will be displayed with a changes tree showing the changes that will be made when the object(s) is 'included' into the new file.
    If two objects of the same name are recognized within a project, a window will display so that the relevant object can be selected.

  1. You can scroll through the different changes using the scrolling arrows .
    Note that that include_once will now be added for each object that you are attempting to call, with the name and location of the file in which it was created.

  2. Unmark the checkbox of changes which you do not want applied.

  3. Click OK to apply the changes.

All objects that were called into the file from other files will now have an 'include_once' command.

Note:

Only static include calls will be refactored.

The Organize Includes feature can also:

Note:

If the included files are not contained within the same project as the active file, their location must be added to the project's include path in order for them to be 'Organize Includes' feature to work fully.
See the 'Include Paths' and 'Adding Elements to a Project's Include Path' topics for more information.

 

 

Related Links

Related Links:

Refactoring

Working with the Refactoring Feature

Using Refactoring

Renaming Files

Renaming Elements

Moving Files

Refactor Menu