function show_view($view, $vars = array(), $return = FALSE) { $load = new CI_Loader(); $load->view("includes/header"); $load->view($view, $vars, $return); $load->view("includes/footer"); }
public function render_view($view, $breadcrumbs, $data, $folder = 'admin', $js = [], $css = [], $return = false) { // Загружаем хэдер $page['footer'] = $this->load->view('_blocks/header', ['page_title' => lang('main_title'), 'custom_js' => $js, 'custom_css' => $css, 'menus' => $this->get_menus(), 'menu_item' => $this->menu_item, 'breadcrumbs' => $breadcrumbs], $return); // Загружаем шаблон страницы $page['body'] = $this->load->view($folder . '/' . $view, $data, $return); // Загружаем футер $page['footer'] = $this->load->view('_blocks/footer', [], $return); if ($return) { return implode('', $page); } }
public function view($view, $vars = array(), $return = FALSE) { $CI =& get_instance(); if (isset($CI->local)) { $file_exists = FALSE; $_ci_path = ''; $_ci_view = $view . '__' . $CI->local['code']; $_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 or file_exists($_ci_path)) { $view = $_ci_view; } } return parent::view($view, $vars, $return); }
/** * 提供按钮的ID列表,初始化插件组件 * @param array $buttonIds * @param string $uploadUrl * @param string $secType 选择图片类型(local:本地上传,remote:远程图片,all:本地远程图片) * @param string $managerUrl 远程图片列表地址(远程图片列表json格式,具体格式参考模板文件) */ function initUploadImage($buttonIds = array(), $uploadUrl = '', $secType = 'local', $managerUrl = '') { $data = array('buttonIds' => $buttonIds, 'uploadUrl' => $uploadUrl, 'secType' => $secType, 'managerUrl' => $managerUrl); $loader = new CI_Loader(); $content = $loader->view('common/initUploadImage', $data, true); echo $content; }
function view($view, $params = array(), $string = false) { $str_contenido = parent::view($view, $params, true); $str = parent::view("layout/layout", array("contenido" => $str_contenido), true); if ($string) { return $str; } else { echo $str; } }
function view($view, $vars = array(), $return = FALSE) { // if $view is an array, bump all parameters up if (is_array($view)) { $return = !is_array($vars); $vars = $view; global $RTR; return parent::view($RTR->fetch_method(), $vars, $return); } else { return parent::view($view, $vars, $return); } }
/** * Load CI View * * This is extended to keep some backward compatibility for people * changing _ci_view_path. I tried doing a getter/setter, but since all * of CI's object references are stuck onto the loader when loading views * I get access errors left and right. -pk * * @deprecated * @access public */ public function view($view, $vars = array(), $return = FALSE) { if ($this->ee_view_depth === 0 && $this->_ci_view_path != '') { $this->_ci_view_paths = array($this->_ci_view_path => FALSE) + $this->_ci_view_paths; } $this->ee_view_depth++; $ret = parent::view($view, $vars, $return); $this->ee_view_depth--; if ($this->ee_view_depth === 0 && $this->_ci_view_path != '') { array_shift($this->_ci_view_paths); } return $ret; }
public function view($view, $vars = array(), $return = FALSE) { global $view_folder; /* $CI =& get_instance(); $lang = $CI->security->sanitize_filename( $CI->config->item('language') ); if( file_exists($view_folder.$lang.'/'.$view.'.php') ) { $view = $lang.'/'.$view; } */ return parent::view($view, $vars, $return); }
public function view($view, $vars = array(), $return = FALSE) { // XXX: yep, this is all pretty hacky. is there a better way to do this in CI? if ($this->request_is_format('json') && !in_array($view, self::$ALWAYS_ALLOW_HTML_VIEWS)) { // ignore header/footer calls for JSON calls if (in_array($view, self::$HTML_ONLY_VIEWS)) { if ($return) { return ''; } return; } // TODO: search for "$view.json" on filesystem before attempting to load it $view .= '.json.php'; } return parent::view($view, $vars, $return); }
/** * Load View * * This extended function exists to provide overloading of themes. It's silly and * difficult trying to maintain multiple themes that are just tweaks to CSS and images. * Brandon is a smart cookie for thinking this idea up. -ga * * @param string * @param array variables to be loaded into the view * @param bool return or not * @return void */ public function view($view, $vars = array(), $return = FALSE) { $paths = $this->_ci_view_path; if (is_array($this->_ci_view_path)) { $ext = pathinfo($view, PATHINFO_EXTENSION); $ext = $ext ? '' : EXT; foreach ($this->_ci_view_path as $path) { if (file_exists($path . $view . $ext)) { $this->_ci_view_path = $path; break; } } } $ret = parent::view($view, $vars, $return); $this->_ci_view_path = $paths; return $ret; }
/** * 打印题目数据 * @param array $data */ function printProActItem($data) { //操作类型(edit:编辑,check:查看,) $data['action'] = isset($data['action']) ? $data['action'] : 'edit'; $loader = new CI_Loader(); //上传图片配置 if ($data['type'] == 6) { $data['uploadUrl'] = printUrl('Upload', 'uploadSave', array('dir' => 'image')); $data['extraParams'] = array('itemId' => $data['itemId'], 'proId' => $data['proId'], 'actId' => $data['actId'], 'type' => $data['type']); } //上传附件配置 if ($data['type'] == 7) { $data['uploadUrl'] = printUrl('Upload', 'uploadSave', array('dir' => 'settleFile')); $data['extraParams'] = array('itemId' => $data['itemId'], 'proId' => $data['proId'], 'actId' => $data['actId'], 'type' => $data['type']); } $content = $loader->view('ProActItem/actItem' . $data['type'], $data, true); echo $content; }
/** * Load CI View * * This is extended to keep some backward compatibility for people * changing _ci_view_path. I tried doing a getter/setter, but since all * of CI's object references are stuck onto the loader when loading views * I get access errors left and right. -pk * * @deprecated 2.6 */ public function view($view, $vars = array(), $return = FALSE) { if ($this->ee_view_depth === 0 && $this->_ci_view_path != '') { ee()->load->library('logger'); ee()->logger->deprecated('2.6', 'load::add_package_path()'); $this->_ci_view_paths = array($this->_ci_view_path => FALSE) + $this->_ci_view_paths; } if (is_array($vars) && isset($vars['cp_page_title'])) { ee()->view->cp_page_title = $vars['cp_page_title']; } $this->ee_view_depth++; $ret = parent::view($view, $vars, $return); $this->ee_view_depth--; if ($this->ee_view_depth === 0 && $this->_ci_view_path != '') { array_shift($this->_ci_view_paths); } return $ret; }
/** * @param $part_name: FALSE:进入输出缓存, 否则存入Loader::part[$part_name] */ function view($view, $return = FALSE, $block_name = FALSE) { if (array_key_exists($view, $this->view_path)) { $view = $this->view_path[$view]; } $vars = $this->getViewData(); //每次载入视图时,都将当前视图数据传递给他一次 if ($block_name === FALSE) { return parent::view($view, $vars, $return); } else { if (!array_key_exists($block_name, $this->blocks)) { $this->blocks[$block_name] = ''; } $block = parent::view($view, $vars, TRUE); $this->blocks[$block_name] .= $block; return $block; } }
/** * @param string $aView * @param array $aData * @param string $aLayout * @param string $aLanguage The locale variant of the view file which should be used. */ public function view($aView = null, $aData = array(), $aLayout = null, $aLanguage = null) { if (is_null($aView)) { $aView = strtolower($this->controllerName) . '/' . strtolower($this->controllerFunction); } $lLayout = is_null($aLayout) ? $this->layout : $aLayout; $lLanguage = is_null($aLanguage) ? $this->language : $aLanguage; $aData += array('viewLayout' => $lLayout, 'viewLanguage' => $lLanguage); $lViewsPath = APPPATH . 'views'; $localizedViewPath = $lViewsPath . '/' . (!empty($lLayout) ? $lLayout . DIRECTORY_SEPARATOR : '') . $aView . '_' . $lLanguage . EXT; // var_dump($lLanguage, $localizedViewPath); if (file_exists($localizedViewPath)) { // var_dump($lLayout.DIRECTORY_SEPARATOR.$aView.'_'.$lLanguage); parent::view($lLayout . DIRECTORY_SEPARATOR . $aView . '_' . $lLanguage, $aData); } elseif (file_exists($lViewsPath . '/' . $lLayout . DIRECTORY_SEPARATOR . $aView . EXT)) { log_message('warning', sprintf('No localized version of %s could be found for language %s. Using non-localized one.', $aView, $lLanguage)); parent::view($lLayout . DIRECTORY_SEPARATOR . $aView, $aData); } else { log_message('warning', sprintf('No default version of %s could be found. (Layout:"%s" Language: "%s")', $aView, $lLayout, $lLanguage)); show_error(sprintf('Unable to load the requested file: "%s"; Layout: "%s"; Language "%s";', $lViewsPath . '/' . $lLayout . '/' . $aView . EXT, $lLanguage, $lLayout)); } }
/** * Load View * * This function is used to load a "view" file. It has three parameters: * * 1. The name of the "view" file to be included. * 2. An associative array of data to be extracted for use in the view. * 3. TRUE/FALSE - whether to return the data or load it. In * some cases it's advantageous to be able to return data so that * a developer can process it in some way. * * @param string * @param array * @param bool * @return void */ public function view($view, $vars = array(), $return = FALSE) { if ($return === TRUE) { return parent::view($view, $vars, $return); } $output = $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => TRUE)); $CI =& get_instance(); $CI->output->append_view($view); $CI->output->append_output($output); }
function view($view, $vars = array(), $return = FALSE) { foreach ($this->_ci_view_paths as $view_path => $show) { $exploded = explode('/', trim($view, '/')); $trim_view = $exploded[count($exploded) - 1]; if (file_exists($view_path . $view . '.php')) { $view = $view; break; } elseif (file_exists($view_path . $trim_view . '.php')) { $view = $trim_view; break; } } return parent::view($view, $vars, $return); }
/** * {@inheritdoc} */ public function view($view, $vars = array(), $return = FALSE) { $view = $this->_parse_path($view, $this->_ci_view_paths, TRUE); return parent::view($view, $vars, $return); }
/** * Load View * * This function is used to load a "view" file. It has three parameters: * * 1. The name of the "view" file to be included. * 2. An associative array of data to be extracted for use in the view. * 3. TRUE/FALSE - whether to return the data or load it. In * some cases it's advantageous to be able to return data so that * a developer can process it in some way. * * @param string * @param array * @param bool * @return void */ public function view($view, $vars = array(), $return = FALSE) { // Detect module if (list($module, $class) = $this->detect_module($view)) { // Module already loaded if (in_array($module, $this->_ci_modules)) { return parent::view($class, $vars, $return); } // Add module $this->add_module($module); // Let parent do the heavy work $void = parent::view($class, $vars, $return); // Remove module $this->remove_module(); return $void; } else { return parent::view($view, $vars, $return); } }
/** * Load View * * This function is used to load a "view" file. It has three parameters: * * 1. The name of the "view" file to be included. * 2. An associative array of data to be extracted for use in the view. * 3. TRUE/FALSE - whether to return the data or load it. In * some cases it's advantageous to be able to return data so that * a developer can process it in some way. * * @param string * @param array * @param bool * @return void */ public function view($view, $vars = array(), $return = FALSE) { // Allow application/views/* to override any module // views for easier app customization. if (file_exists(APPPATH . 'views/' . $view . '.php')) { return parent::view($view, $vars, $return); } // Detect module if (list($module, $class) = $this->detect_module($view)) { // Module already loaded if (in_array($module, $this->_ci_modules)) { return parent::view($class, $vars, $return); } // Add module $this->add_module($module); // Let parent do the heavy work $void = parent::view($class, $vars, $return); // Remove module $this->remove_module(); return $void; } else { return parent::view($view, $vars, $return); } }
/** * Load View * * This extends the view method. It loads helpers and passes off error messages. * * @access public * @param string $view * @param array $vars[optional] * @param boolean $return[optional] */ public function view($view, $vars = array(), $return = FALSE) { $this->passData = $vars; $this->loadHelpers(); parent::view('themes/' . config_item('theme') . '/' . $view, $this->passData, $return); }
/** * Since there aren't any hooks for loading views, we decorate view(). **/ function view($view, $vars = array(), $return = FALSE) { // init our stuff. $this->_views =& new JI_View($view); $this->_view_names = array(self::_canonical_view_name($view) => 1); $this->_current_view = $this->_views; $this->_current_block = $this->_current_view->_blocks; // 1st run - build structure; don't output anything. $this->_build_run = TRUE; while ($this->_current_view !== NULL) { $this->_current_block = $this->_current_view->_blocks; $str = parent::view($this->_current_view->_name, $vars, true); $this->_current_view = $this->_current_view->_next; } // 2nd run - actually output stuff. $this->_build_run = FALSE; $this->_current_view = $this->_views; while ($this->_current_view !== NULL) { $this->_current_block = $this->_current_view->_blocks; $str = parent::view($this->_current_view->_name, $vars, $this->_current_view->_next !== NULL || $return); $this->_current_view = $this->_current_view->_next; } // Return the last run - the base template. if ($return) { return $str; } }
/** * 初始化百度附件上传控件 * @param string $container */ function initUeditorFiles($container) { $data = array('container' => $container); $loader = new CI_Loader(); $content = $loader->view('common/initUeditorFiles', $data, true); echo $content; }
/** * {inheritdoc} */ public function view($view, $vars = [], $return = false) { if ($this->is_loaded('views')) { // get CI Instance $CI =& get_instance(); // Add cached variables $CI->views->add_data($this->_ci_cached_vars); // Append to CI output $CI->output->append_output($CI->views->render($view, $vars)); return $this; } return parent::view($view, $vars, $return); }