codeigniter check view file exists
class MY_Loader extends CI_Loader
{
public function view($view, $vars = array(), $return = FALSE)
{
foreach (array('_ci_view', '_ci_vars', '_ci_path', '_ci_return') as $_ci_val)
{
$$_ci_val = isset($_ci_data[$_ci_val]) ? $_ci_data[$_ci_val] : FALSE;
}
$file_exists = FALSE;
// Set the path to the requested file
if (is_string($_ci_path) && $_ci_path !== '')
{
$_ci_x = explode('/', $_ci_path);
$_ci_file = end($_ci_x);
}
else
{
$_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION);
$_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view;
foreach ($this->_ci_view_paths as $_ci_view_file => $cascade)
{
if (file_exists($_ci_view_file.$_ci_file))
{
$_ci_path = $_ci_view_file.$_ci_file;
$file_exists = TRUE;
break;
}
if ( ! $cascade)
{
break;
}
}
}
if ( ! $file_exists && ! file_exists($_ci_path))
{
throw new Exception('View file '.$view.' doesn\'t exist.');
}
return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_prepare_view_vars($vars), '_ci_return' => $return));
}
}
Also in PHP:
- Laravel users_email_unique
- Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:cer
- current date format in php
- check key exist in array php
- ADD OR ON SWITCH CASE PHP
- DateTime() php
- file de redirection php
- DateTime::diff()
- Allowed memory size of 2147483648 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0
- date format Ymd php
- echo console.log
- create a laravel project php 8
- extract($user_input); alternative php
- 'laravel collective"Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52
- cake tmp name
- convert matrix row to column php
- deactivate woocommerce breadcrumbs
- exception php throw
- collection map laravel
- 1,200 covert to int php
- array key exist in phgp
- date('d') in php
- display datetime in php
- alert laravel 7