| Line 56... |
Line 56... |
| 56 |
//standard array
|
56 |
//standard array
|
| 57 |
$data = array();
|
57 |
$data = array();
|
| 58 |
//get cache
|
58 |
//get cache
|
| 59 |
$configdata =array();
|
59 |
$configdata =array();
|
| 60 |
$configdata = $this->config->item('home');
|
60 |
$configdata = $this->config->item('home');
|
| - |
|
61 |
$checkConfig = $this->config->item('home');
|
| 61 |
$cachemodule = array('header','footer','response');
|
62 |
$cachemodule = array('header','footer','response');
|
| 62 |
$configdata = getCache($configdata,$cachemodule);
|
63 |
$configdata = getCache($configdata,$cachemodule);
|
| - |
|
64 |
$newData = array();
|
| - |
|
65 |
foreach ($checkConfig['response'] as $key => $value) {
|
| - |
|
66 |
if($value != 'recommended_accessories' && $value != 'recharge_icons'){
|
| - |
|
67 |
$newData[] = $value;
|
| - |
|
68 |
}
|
| - |
|
69 |
}
|
| - |
|
70 |
$newparams = array();
|
| - |
|
71 |
if(isset($configdata['response'])){
|
| - |
|
72 |
foreach($newData as $key => $value){
|
| - |
|
73 |
if(!array_key_exists($value,$configdata['response'])){
|
| - |
|
74 |
$api = 1;
|
| - |
|
75 |
}
|
| - |
|
76 |
}
|
| - |
|
77 |
}
|
| 63 |
//end of get cache
|
78 |
//end of get cache
|
| 64 |
$this->lessphp->object()->ccompile('assets/css/common.less','assets/css/common.css');
|
79 |
$this->lessphp->object()->ccompile('assets/css/common.less','assets/css/common.css');
|
| 65 |
$data['stylesheet'] = 'common.css';
|
80 |
$data['stylesheet'] = 'common.css';
|
| - |
|
81 |
if(isset($api) && $api == 1){
|
| - |
|
82 |
$data['response']=$this->home_model->getHome($this->input->get(),$this->input->post(),$this->config->item('home'));
|
| - |
|
83 |
}elseif(!isset($api)){
|
| 66 |
$data['response']=$this->home_model->getHome($this->input->get(),$this->input->post(),$configdata['module']);
|
84 |
$data['response']=$this->home_model->getHome($this->input->get(),$this->input->post(),$configdata['module']);
|
| - |
|
85 |
}
|
| - |
|
86 |
//print_r($data['response']);
|
| 67 |
$tmp = $data['response'];
|
87 |
$tmp = $data['response'];
|
| 68 |
//set cache to output or renew cache
|
88 |
//set cache to output or renew cache
|
| 69 |
if(isset($cachemodule) and !empty($cachemodule))
|
89 |
if(isset($cachemodule) and !empty($cachemodule) && !isset($api))
|
| 70 |
{
|
90 |
{
|
| 71 |
foreach($cachemodule as $cm)
|
91 |
foreach($cachemodule as $cm)
|
| 72 |
{
|
92 |
{
|
| 73 |
if(isset($configdata[$cm]) and !empty($configdata[$cm]))
|
93 |
if(isset($configdata[$cm]) and !empty($configdata[$cm]))
|
| 74 |
{
|
94 |
{
|
| 75 |
$data['response'][$cm]=$configdata[$cm];
|
95 |
$data['response'][$cm]=$configdata[$cm];
|
| 76 |
}
|
96 |
}
|
| 77 |
}
|
97 |
}
|
| 78 |
}
|
98 |
}
|
| 79 |
//print_r($data['response']['response']);
|
99 |
if(isset($data['response']['response'])){
|
| 80 |
if(isset($data['response']['response']) && !empty($data['response']['response'])){
|
- |
|
| 81 |
foreach($data['response']['response'] as $rs)
|
100 |
foreach($newData as $key => $value){
|
| 82 |
{
|
- |
|
| 83 |
if(!isset($rs) || empty($rs)){
|
101 |
if(!array_key_exists($value,$data['response']['response'])){
|
| 84 |
$cache = 0;
|
102 |
$noCache = 1;
|
| 85 |
break;
|
- |
|
| 86 |
}
|
103 |
}
|
| 87 |
}
|
104 |
}
|
| 88 |
}
|
105 |
}
|
| - |
|
106 |
//print_r($newparams);
|
| 89 |
if(!isset($cache) || $cache != 0){
|
107 |
if(!isset($noCache)){
|
| 90 |
setCache($configdata['module'],$cachemodule,$data['response']);
|
108 |
setCache($configdata['module'],$cachemodule,$data['response']);
|
| 91 |
}
|
109 |
}
|
| 92 |
if(isset($data['response']['response']['home_featured_product']) && !empty($data['response']['response']['home_featured_product'])){
|
110 |
if(!isset($data['response']['response']['home_featured_product']) && empty($data['response']['response']['home_featured_product'])){
|
| 93 |
$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_featured_product','recharge_icons',$tmp['response']['recharge_icons']);
|
- |
|
| 94 |
}else{
|
- |
|
| 95 |
$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_menu','recharge_icons',$tmp['response']['recharge_icons']);
|
111 |
$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_menu','recharge_icons',$tmp['response']['recharge_icons']);
|
| - |
|
112 |
}else{
|
| - |
|
113 |
$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_featured_product','recharge_icons',$tmp['response']['recharge_icons']);
|
| 96 |
}
|
114 |
}
|
| 97 |
$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_menu','recommended_accessories',$tmp['response']['recommended_accessories']);
|
115 |
$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_menu','recommended_accessories',$tmp['response']['recommended_accessories']);
|
| 98 |
//end of set cache\
|
116 |
//end of set cache\
|
| 99 |
$this->layout->view('home/home_view',$data);
|
117 |
$this->layout->view('home/home_view',$data);
|
| 100 |
}
|
118 |
}
|