index.php
7.26 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?php $this->_extends('layout/default_layout');?>
<?php $this->_block('main');?>
<?php if(!empty($this->view->banners)):?>
<div class="bd">
<div class="slide-main clearfix">
<div class="slide-box-warp">
<div class="slide-box">
<div class="slide-wrap clearfix">
<?php foreach($this->view->banners as $banner):?>
<div class="box">
<a href="<?php echo $banner['url'];?>" target="_blank" title="<?php echo $banner['text'];?>">
<img src="<?php echo Lib_Images::getImageUrl($banner['res'],'1180x0580','fragmentimg');?>" alt=""/>
</a>
</div>
<?php endforeach;?>
</div>
</div>
<div class="slide-navigator">
<div class="dib clearfix">
<?php echo '<a href="javascript:;" class="on"></a>'.str_repeat('<a href="javascript:;"></a>', count($this->view->banners) - 1);?>
</div>
</div>
<div class="slide-control">
<a class="slide-prev iconfont" href="javascript:void(0);"></a>
<a class="slide-next iconfont" href="javascript:void(0);"></a>
</div>
</div>
</div>
<div class="content-wrap clearfix">
<div class="fluid-list">
<div class="fluid-list-inner main-layout clearfix" id="img_flow">
<?php
$this->_widget('news_list', array('list'=> $this->view->news));
?>
</div>
<div id="pageContent" style="text-align: center;" class="pagination">
<?php $this->_component('Common_Pagination',array(
'pagination' => $this->view->pagination,'next_label' => 'NEXT>>','prev_label' => '<<','current_class' => 'current',
'page_class'=>'pagination-inner', 'id'=>'img_page'
));?>
</div>
</div>
</div>
<?php endif;?>
<div class="brand-main">
<?php if($this->view->brandTotal):?>
<div class="search-wrap">
<input type="text" placeholder="搜索品牌..." maxlength="30">
<a href="javascript:;" class="search-btn iconfont"></a>
</div>
<div class="brand-content">
<ul class="brand-list cooperation-list clearfix">
<br/>
</ul>
</div>
<?php else: //不存在,显示coming soon?>
<img src="<?php echo SITE_RES.'/images/yohood/comingsoon.jpg';?>" style="width:100%;"/>
<?php endif;?>
</div>
<div id="brand_detail">
</div>
<div class="overlay"></div>
<?php if(count($this->view->partnerList)):?>
<!-- 合作商等信息滑动条 start -->
<div class="cooperation clearfix">
<div class="cooperation-slide-warp">
<div class="cooperation-slide-box">
<div class="slide-wrap clearfix">
<?php
$partnerGroups = array();
foreach($this->view->partnerList as $partner)
{
foreach($this->view->partnerTypes as $key => $type)
{
if($partner['type'] == $key)
{
$partnerGroups[$type][] = $partner;
}
}
}
$groupNum = 0;
$groupLen = 0;
$template = '';
$html = '';
foreach($partnerGroups as $type => $group)
{
foreach ($group as $key => $partner)
{
$pic = Lib_Images::getImageUrl($partner['pic'], 'source','fragmentimg');
$html.= <<<EOL
<li>
<a href="{$partner['url']}" title="{$partner['name']}" target="_blank">
<img src="{$pic}" alt="" style="width:70px;"/>
</a>
</li>
EOL;
$groupLen ++;
if($groupLen>= 6)
{
$templates[] ='<div class="{class}"><h2>'.$type.'</h2><ul class="clearfix">'.$html.'</ul></div>';
$html = '';
$groupLen = 0;
$groupNum = 0;
}
}
if(!empty($html))
{
$templates[] ='<div class="{class}"><h2>'.$type.'</h2><ul class="clearfix">'.$html.'</ul></div>';
$html = '';
}
$groupNum ++;
if($groupNum == 2 && !empty($html))
{
$templates[] ='<div class="{class}"><h2>'.$type.'</h2><ul class="clearfix">'.$html.'</ul></div>';
$html = '';
$groupNum = 0;
$groupLen = 0;
}
}
$pos = 0;
foreach($templates as $temp)
{
if($pos % 2 == 0)
{
$temp = str_replace('{class}','partner', $temp);
}
else
{
$temp = str_replace('{class}','media', $temp);
}
preg_match_all("/<li>/i", $temp, $liLen, PREG_SET_ORDER);
if(count($liLen) >= 6)
{
$temp = preg_replace('@<div class="(\w+)">(.+)<\/div>@isU', "\\2", $temp);
$template .='<div class="box clearfix">'.$temp.'</div>';
$pos = -1;
}
else
{
if($pos % 2 == 0)
{
$template .='<div class="box clearfix">';
}
$template .= $temp;
if(($pos+1) % 2 == 0)
{
$template .='</div>';
}
}
$pos++;
}
if($pos % 2 == 1)
{
$template .='</div>';
}
echo $template;
?>
</div>
</div>
<div class="cooperation-slide-control">
<a class="cooperation-slide-prev iconfont" href="javascript:void(0);"></a>
<a class="cooperation-slide-next iconfont" href="javascript:void(0);"></a>
</div>
</div>
</div>
<?php endif;?>
<!-- 合作商等信息滑动条 end -->
</div>
<?php $this->_endblock();?>
<?php $this->_block('js');?>
<script type="text/javascript">
seajs.use('yohood',function(yohood){
yohood.brand();
});
</script>
<?php $this->_endblock();?>