php maincache CACHE categ maincache desc str_replace br maincache desc

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
$maincache = $CACHE['categ'];
$maincache['desc'] = str_replace("<br>", " ", $maincache['desc']);
$features_arr = get_keywords($categ);
$features_arr = array_slice($features_arr,-10,10);
for($i = 0; $i < count($features_arr); $i++){
if($keyword == $features_arr[$i]) continue;
$arr = create_categ_cache($features_arr[$i], $categ);
if(!$arr) continue;
$features[$i]['key'] = $arr['real_key'];
$features[$i]['url'] = $arr['url'];
$features[$i]['real_key'] = $arr['real_key'];
$features[$i]['img'] = $arr['mini_img'];
$features[$i]['date'] = $arr['date'];
$features[$i]['num'] = $i + 1;
$features[$i]['minidesc'] = strip_tags($arr['desc']);
}
array_shift($lastpage);
$COUNT_MAIN_LAST_KEYS = COUNT_MAIN_LAST_KEYS;
if(file_exists(SERVER . "/cache/etc/main_posts")){
$add_main_posts = file(SERVER . "/cache/etc/main_posts", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if(!empty($add_main_posts)){
$COUNT_MAIN_LAST_KEYS += count($add_main_posts);
$lastpage = array_merge($add_main_posts ,$lastpage);
}
}
$pages = array();
// показываем последнии кеи
foreach($lastpage as $cnt=>$str){
$exp = explode("|",trim($str));
$cache = create_categ_cache($exp[1],$exp[0]);
if(!$cache) continue;
if(count($pages)%2!==0){
$cache['div_end'] = '</div>';
$cache['style_tanbox'] = 'right';
}else{
$cache['div_start'] = '<div class="clearfloat">';
$cache['style_tanbox'] = 'left';
}
$pages[] = $cache;
if(count($pages) == $COUNT_MAIN_LAST_KEYS) break;
}
if(count($pages)%2!==0) array_pop($pages);
$tpl->assign('headline_pic', $maincache['headline_pic']);
$tpl->assign('desc_for_main', $maincache['desc']);
$tpl->assign('pages', $pages);
$tpl->assign('features', $features);
?>