Skip to content

Improved view file initialisation

Compare
Choose a tag to compare
@trongate trongate released this 17 Jun 16:56
· 99 commits to master since this release

Improved View File Path Establishment

This release enhances how view file paths are determined.

Techniques Used:

  1. Assume the containing module (view file module) is equal to the value of $data['view_module'], if the 'view_module' property has been set.

  2. Assume the containing module (view file module) is equal to the current class converted to lowercase.

  3. If step 2 fails to find an existing view file, evaluate the first segment of the URL. If the first segment contains one forward slash with two strings on either side, assume the containing module (view file module) is equal to the first URL segment with '-' replaced by '/'.

What does this mean?

This update allows us to load view files without explicitly declaring a $data['view_module'] value. Even when dealing with sub-modules, the system can establish the view file location, even if $data['view_module'] has not been set.

However, there is still value in declaring $data['view_module']. It can be useful in scenarios involving URL rewriting. Additionally, since a try/catch block is used when $data['view_module'] has NOT been set, there could be a potential performance boost for those who actively declare the $data['view_module'] property.

As always, if you encounter any challenges with this update, please visit our Help Bar.