CodeIgniter Forums
Load View is need allow load from realpath before - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: Load View is need allow load from realpath before (/showthread.php?tid=76553)



Load View is need allow load from realpath before - AnonyX - 05-24-2020

I have just do in my cms when doing with views from both Modules views only can get in one Path View
Line 218: system\View\View.php
PHP Code:
        $this->renderVars['file'] = $this->viewPath $this->renderVars['view'];

        if (! 
is_file($this->renderVars['file']))
        {
            
$this->renderVars['file'] = $this->loader->locateFile($this->renderVars['view'], 'Views', empty($fileExt) ? 'php' $fileExt);
        } 
I thing we need change allow load if is realpath before
PHP Code:
        // Add custom load full path -- AnonyX
        
$this->renderVars['file'] = $this->renderVars['view'];
        if (!
is_file($this->renderVars['file']))
        {
            
$this->renderVars['file'] = $this->viewPath $this->renderVars['view'];
        }
        
        if (! 
is_file($this->renderVars['file']))
        {
            
$this->renderVars['file'] = $this->loader->locateFile($this->renderVars['view'], 'Views', empty($fileExt) ? 'php' $fileExt);
        } 
So we can load layout or view from other Path view when we set realpath
This is better for coding in Modules

I desire CI have in next version