本文整理汇总了PHP中Parse::built_mode_cache方法的典型用法代码示例。如果您正苦于以下问题:PHP Parse::built_mode_cache方法的具体用法?PHP Parse::built_mode_cache怎么用?PHP Parse::built_mode_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse
的用法示例。
在下文中一共展示了Parse::built_mode_cache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cellProcess
/**
* 处理单元、生成单元的html
*
* @param array $info 单元详细信息
* @param boolean $force 是否强制生成单元缓存
* @param array $arData 数据、有此参数时用该数据生成单元hmtl 用于单元预览
* @param array 处理过后的单元详细信息
*/
public function cellProcess($info, $force = false, $arData = array())
{
if (!$info['cell_mode']) {
//return array();
}
/**********专题栏目链接处理***************************/
if (strpos($info['more_href'], 'COLURL') !== false) {
$intColumnId = intval(str_replace('COLURL', '', $info['more_href']));
if (!class_exists('special')) {
include ROOT_PATH . 'lib/class/special.class.php';
}
$objSpecial = new special();
$info['more_href'] = $objSpecial->get_special_col_url($intColumnId);
}
/**********专题栏目链接处理***************************/
$mode_info = common::get_mode_info(intval($info['cell_mode']), $info['id'], intval($info['css_id']), intval($info['js_id']), $info['param_asso']);
$blBuiltCell = $this->blBuiltCell && $this->blBuiltCell !== 'false' ? 1 : 0;
if ($info['cell_type'] == 3 && $blBuiltCell) {
$html = $info['static_html'];
} else {
$content = $mode_info['mode_info']['content'];
$content = str_replace(' ', ' ', $content);
$ret_data = array();
if (!$info['data_source']) {
$map = common::get_mode_map($mode_info);
if ($blBuiltCell) {
$ret_data = !empty($arData) ? $arData : $mode_info['mode_info']['default_param'];
}
$ret_data = $info['using_block'] ? common::getBlockData($info['block_id']) : $ret_data;
} else {
$data_source = common::get_datasource_info($info['data_source'], $info['param_asso']);
if ($info['using_block'] && $blBuiltCell) {
$ret_data = !empty($arData) ? $arData : common::getBlockData($info['block_id']);
} else {
$map = common::get_cell_map($mode_info, $data_source, $info['param_asso']);
if ($blBuiltCell) {
$ret_data = common::get_content_by_datasource($info['data_source'], $map['data_input_variable']);
if (isset($ret_data['total'])) {
$intTotal = $ret_data['total'];
$ret_data = $ret_data['data'];
}
if (!$info['layout_id']) {
//替换已经编辑过的单元数据
if (!class_exists('cell')) {
include CUR_CONF_PATH . 'lib/cell.class.php';
}
$objCell = new cell();
$arCellData = $objCell->getCellData($info['id']);
if (is_array($ret_data) && count($ret_data) > 0) {
foreach ($ret_data as $k => $v) {
!empty($arCellData[$v['id']]) && ($arCellData[$v['id']]['id'] = $arCellData[$v['id']]['content_id']);
$ret_data[$k] = !empty($arCellData[$v['id']]) ? $arCellData[$v['id']] : $v;
if (!empty($arData)) {
if ($v['id'] == $arData['content_id']) {
//arData 预览提交的数据
$arData['id'] = $arData['content_id'];
$ret_data[$k] = $arData;
}
}
}
}
}
if (isset($intTotal)) {
$ret_data = array('total' => $intTotal, 'data' => $ret_data);
}
}
}
}
$cache_file = $info['layout_id'] ? $info['id'] . '_' . $info['layout_id'] . '.php' : $info['id'] . '.php';
$cache_filepath = MODE_CACHE_DIR . substr(md5($cache_file), 0, 2) . '/';
include_once CUR_CONF_PATH . 'lib/parse.class.php';
$parse = new Parse();
$parse->parse_template(stripcslashes($content), $info['id'], $mode_info['mode_info'], $map['relation_map'], $map['mode_variable_map'], $map['variable_function_relation']);
if ($blBuiltCell) {
if (MAGIC_DEBUG) {
$path = CUR_CONF_PATH . 'cache/log/data/';
hg_mkdir($path);
hg_file_write($path . $info['id'] . '.txt', var_export($map['data_input_variable'], 1) . var_export($ret_data, 1));
}
$html = $parse->built_cell_html($ret_data, $cache_file, $mode_info['mode_info'], $this->arNeedPageInfo, $this->arPageSiteInfo, $this->arPageColumnInfo, $this->arPageClientInfo, $this->arPageSpecialInfo, $this->arPageSpecialColumnInfo, $map['data_input_variable'], $force, $cache_filepath);
if ($info['is_header']) {
$find = array('{$header_text}', '{$more_href}', '{$more_text}');
$replace = array($info['header_text'], $info['is_more'] ? $info['more_href'] : '#', $info['is_more'] ? '更多>>' : '');
$header = str_replace($find, $replace, $this->settings['header_dom']['cell']);
$html = $header . $html;
}
// if (empty($ret_data)) {
// $html = '<span>暂无数据</span>' . $html;
// }
} else {
$parse->built_mode_cache($cache_file, $cache_filepath);
}
//.........这里部分代码省略.........
示例2: array
function get_layout_cell($layout_ids)
{
if (!$layout_ids) {
return array();
}
$sql = "SELECT * FROM " . DB_PREFIX . "layout_cell WHERE layout_id IN( " . $layout_ids . ")";
$q = $this->db->query($sql);
$cell = array();
while ($row = $this->db->fetch_array($q)) {
//专题栏目链接处理
if (strpos($row['more_href'], 'COLURL') !== false) {
$intColumnId = intval(str_replace('COLURL', '', $row['more_href']));
if (!class_exists('special')) {
include ROOT_PATH . 'lib/class/special.class.php';
}
$objSpecial = new special();
$row['more_href'] = $objSpecial->get_special_col_url($intColumnId);
}
$row['param_asso'] = unserialize($row['param_asso']);
$mode_info = self::get_mode_info($row['cell_mode'], $row['id'], $row['css_id'], $row['js_id'], $row['param_asso']);
if ($row['data_source']) {
$data_source_ids[$row['id']] = $row['data_source'];
$data_source = self::get_datasource_info($row['data_source'], $row['param_asso']);
$map = self::get_cell_map($mode_info, $data_source, $row['param_asso']);
} else {
$map = self::get_mode_map($mode_info);
}
$cache_file = $row['id'] . '.php';
include_once CUR_CONF_PATH . 'lib/parse.class.php';
$parse = new Parse();
$content = $mode_info['mode_info']['content'];
$parse->parse_template($content, $row['id'], $mode_info['mode_info'], $map['relation_map'], $map['mode_variable_map'], $map['variable_function_relation']);
$parse->built_mode_cache($cache_file);
$cell[$row['layout_id']][$row['id'] . '_' . $row['cell_name']] = array_merge($row, $mode_info);
$cell[$row['layout_id']][$row['id'] . '_' . $row['cell_name']]['mode_detail'] = $cell[$row['layout_id']][$row['id']]['mode_info'];
unset($cell[$row['layout_id']][$row['id'] . '_' . $row['cell_name']]['mode_info']);
$cell[$row['layout_id']][$row['id'] . '_' . $row['cell_name']]['data_source_info'] = $data_source['info'];
$cell[$row['layout_id']][$row['id'] . '_' . $row['cell_name']]['input_param'] = $data_source['input_param'];
$cell[$row['layout_id']][$row['id'] . '_' . $row['cell_name']]['input_param_other'] = $map['data_input_variable'];
}
return array('cell' => $cell, 'data_source' => $data_source_ids);
}