本文整理汇总了PHP中CI_Loader::view方法的典型用法代码示例。如果您正苦于以下问题:PHP CI_Loader::view方法的具体用法?PHP CI_Loader::view怎么用?PHP CI_Loader::view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CI_Loader
的用法示例。
在下文中一共展示了CI_Loader::view方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
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");
}
示例2: render_view
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);
}
}
示例3: view
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);
}
示例4: initUploadImage
/**
* 提供按钮的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;
}
示例5: view
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;
}
}
示例6: view
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);
}
}
示例7: view
/**
* 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;
}
示例8: view
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);
}
示例9: view
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);
}
示例10: view
/**
* 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;
}
示例11: printProActItem
/**
* 打印题目数据
* @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;
}
示例12: view
/**
* 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;
}
示例13: view
/**
* @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;
}
}
示例14: view
/**
* @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));
}
}
示例15: view
/**
* 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);
}