Welcome Guest, Not a member yet? Register   Sign In
Modules and Views
#2

After all that I seem to have found the solution.


Code:
// Airports Controller

    public function moduleTest()
    {
        $data['title']="Module View";
    echo view('Bobk\airports\Views\moduleTest', $data);
    }
The word 'Views' must start with a capital V.
Previously had it set to:
echo view('Bobk\airports\views\moduleTest', $data);

This is regardless of how the folder names are actually written in the file system.
Mine are all lower case (windows) after the namespace prefix
 Bobk/airports/controllers
 Bobk/airports/models
 Bobk/airports/views

This is where 'Views' must be capitalized first letter
system/AutoLoader/FileLocator::locateFile
Code:
    // If we have a folder name, then the calling function
    // expects this file to be within that folder, like 'Views',
    // or 'libraries'.
    if (! empty($folder) && strpos($path . $filename, '/' . $folder . '/') === false)
    {
                $path .= trim($folder, '/') . '/';
    }
The PHP function strpos() is case sensitive.
If $folder is set to 'views' (lowercase first letter) strpos() returns false and "Views/" is added to $path
resulting in a $path which is incorrect.

If $folder is set to 'Views' (capital first letter) strpos() returns a positive number (position) and 
the If block is NOT executed so $path is not modified and subsequently the correct full pathname
is returned.
Reply


Messages In This Thread
Modules and Views - by [email protected] - 03-29-2021, 11:28 AM
RE: Modules and Views - by [email protected] - 03-29-2021, 03:37 PM
RE: Modules and Views - by InsiteFX - 03-29-2021, 08:51 PM
RE: Modules and Views - by [email protected] - 03-30-2021, 06:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB