Example #1
0
 *
 * @package     PHPLucidFrame\App
 * @since       PHPLucidFrame v 1.0.0
 * @copyright   Copyright (c), PHPLucidFrame.
 * @author      Sithu K. <*****@*****.**>
 * @link        http://phplucidframe.com
 * @license     http://www.opensource.org/licenses/mit-license.php MIT License
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE
 */
require_once '../lib/bootstrap.php';
ob_start('_flush');
$_page = router();
require $_page;
if (in_array(rtrim(substr($_page, -7), '.php'), array('401', '403', '404'))) {
    _cfg('layoutMode', false);
}
if (_cfg('layoutMode') && _isAjax() === false) {
    $query = _ds(APP_ROOT, _r(), 'query.php');
    if (is_file($query) && file_exists($query)) {
        require_once $query;
    }
    $layout = _i(_ds('inc', 'tpl', _cfg('layoutName') . '.php'));
    if (is_file($layout) && file_exists($layout)) {
        require_once $layout;
    } else {
        die('Layout file is missing: ' . $layout);
    }
}
ob_end_flush();
/**
 * Get view file
 * @return string The view file with absolute path
 */
function _view()
{
    if (_cfg('view')) {
        $viewName = 'view_' . _cfg('view');
    } elseif (_g('view')) {
        $viewName = 'view_' . _g('view');
    } else {
        $viewName = 'view';
    }
    return _i(_ds(_cr(), $viewName . '.php'));
}