Authored by hf

code review by fei.hong: do modify pc home page boys code

@@ -401,7 +401,7 @@ class WebAction extends Controller_Abstract @@ -401,7 +401,7 @@ class WebAction extends Controller_Abstract
401 * @param bool $showMore 是否显示更多内容 401 * @param bool $showMore 是否显示更多内容
402 * @return void 402 * @return void
403 */ 403 */
404 - protected function setTitle($title, $showMore = true, $sign = ' | ') 404 + protected function setTitle($title, $showMore = false, $sign = '')
405 { 405 {
406 $this->_view->assign('title_more', $showMore); 406 $this->_view->assign('title_more', $showMore);
407 $this->_view->assign('title', $title . $sign); 407 $this->_view->assign('title', $title . $sign);
@@ -411,22 +411,25 @@ class WebAction extends Controller_Abstract @@ -411,22 +411,25 @@ class WebAction extends Controller_Abstract
411 * 设置网站SEO的关键词 411 * 设置网站SEO的关键词
412 * 412 *
413 * @param string $keywords 关键词,多个之间用","逗号分隔 413 * @param string $keywords 关键词,多个之间用","逗号分隔
  414 + * @param bool $showMore 是否显示更多内容
  415 + * @param string $sign 连接的字符串
414 * @return void 416 * @return void
415 */ 417 */
416 - protected function setKeywords($keywords) 418 + protected function setKeywords($keywords, $showMore = false, $sign = '')
417 { 419 {
418 - $this->_view->assign('keywords', rtrim($keywords, ',') . ','); 420 + $this->_view->assign('keywords_more', $showMore);
  421 + $this->_view->assign('keywords', rtrim($keywords, ',') . $sign);
419 } 422 }
420 423
421 /** 424 /**
422 * 设置网站SEO的描述内容 425 * 设置网站SEO的描述内容
423 * 426 *
424 * @param string $description 描述内容 427 * @param string $description 描述内容
425 - * @param string $sign 连接的字符串  
426 * @param bool $showMore 是否显示更多内容 428 * @param bool $showMore 是否显示更多内容
  429 + * @param string $sign 连接的字符串
427 * @return void 430 * @return void
428 */ 431 */
429 - protected function setDescription($description, $showMore = true, $sign = ' ') 432 + protected function setDescription($description, $showMore = false, $sign = '')
430 { 433 {
431 $this->_view->assign('description_more', $showMore); 434 $this->_view->assign('description_more', $showMore);
432 $this->_view->assign('description', $description . $sign); 435 $this->_view->assign('description', $description . $sign);
@@ -130,9 +130,9 @@ class TemplateLayout implements View_Interface @@ -130,9 +130,9 @@ class TemplateLayout implements View_Interface
130 } elseif (!isset($tpl_vars['title'])) { 130 } elseif (!isset($tpl_vars['title'])) {
131 $tpl_vars['title'] = $config->seo->title; 131 $tpl_vars['title'] = $config->seo->title;
132 } 132 }
133 - if (isset($tpl_vars['keywords'])) { 133 + if (!empty($tpl_vars['keywords_more'])) {
134 $tpl_vars['keywords'] .= $config->seo->keywords; 134 $tpl_vars['keywords'] .= $config->seo->keywords;
135 - } else { 135 + } elseif (!isset($tpl_vars['keywords'])) {
136 $tpl_vars['keywords'] = $config->seo->keywords; 136 $tpl_vars['keywords'] = $config->seo->keywords;
137 } 137 }
138 if (!empty($tpl_vars['description_more'])) { 138 if (!empty($tpl_vars['description_more'])) {
@@ -14,33 +14,24 @@ class IndexController extends WebAction @@ -14,33 +14,24 @@ class IndexController extends WebAction
14 */ 14 */
15 public function indexAction() 15 public function indexAction()
16 { 16 {
17 - if (isset($_COOKIE['_Channel'])) {  
18 - $this->setCookie('_Channel', '');  
19 - }  
20 - if (isset($_COOKIE['_Gender'])) {  
21 - $this->setCookie('_Gender', ''); 17 + if (null !== $this->get('go')) {
  18 + // 先检查COOKIE是否有访问过, 有则跳转到相应的频道页
  19 + HomeModel::goSwitchChannel();
  20 + } else {
  21 + // 设置客户端浏览器1分钟内不改变
  22 + $this->setLastModified(mktime(date('H'), date('i'), 0, date('n'), date('j'), date('Y')));
  23 + // 设置浏览器缓存1分钟
  24 + $this->setExpires(60);
22 } 25 }
23 26
24 - $this->go('http://www.yohobuy.com');  
25 -  
26 -// if (null !== $this->get('go')) {  
27 -// // 先检查COOKIE是否有访问过, 有则跳转到相应的频道页  
28 -// HomeModel::goSwitchChannel();  
29 -// } else {  
30 -// // 设置客户端浏览器1分钟内不改变  
31 -// $this->setLastModified(mktime(date('H'), date('i'), 0, date('n'), date('j'), date('Y')));  
32 -// // 设置浏览器缓存1分钟  
33 -// $this->setExpires(60);  
34 -// }  
35 -//  
36 -// // 传递模板数据,渲染模板  
37 -// $this->setWebNavHeader(HomeModel::COOKIE_NAME_BOYS);  
38 -// $data = array(  
39 -// 'boysHomePage' => true,  
40 -// 'footerTop'=> true,  
41 -// 'boys' => HomeModel::getChannelResource(HomeModel::COOKIE_NAME_BOYS, HomeModel::CODE_BOYS_CHANNEL)  
42 -// );  
43 -// $this->_view->display('index', $data); 27 + // 传递模板数据,渲染模板
  28 + $this->setWebNavHeader(HomeModel::COOKIE_NAME_BOYS);
  29 + $data = array(
  30 + 'boysHomePage' => true,
  31 + 'footerTop'=> true,
  32 + 'boys' => HomeModel::getChannelResource(HomeModel::COOKIE_NAME_BOYS, HomeModel::CODE_BOYS_CHANNEL)
  33 + );
  34 + $this->_view->display('index', $data);
44 } 35 }
45 36
46 } 37 }