Drupal 7 开发内部培训资料, 分头诗人

view slideshow 只显示过一次

赞成!
0
否决!

我创建了一个view slideshow的区块来做首页幻灯片,但是只显示一篇文章的image field的图片,当添加第二片文章后区块却不再显示图片,只是在右下角显示[1,2]的图片数标识,请问,有网友遇到过这样的问题吗,如何解决呢?

9 个回答

赞成!
0
否决!

需要对Slideshow进行一些必要的设置,此外还需定制CSS。

赞成!
0
否决!
$view = new view();
$view->name = 'Slideshow';
$view->description = 'Default Slideshow';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = '首页的Slideshow';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Slideshow';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['use_more_text'] = '更多';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['exposed_form']['options']['submit_button'] = '应用';
$handler->display->display_options['exposed_form']['options']['reset_button_label'] = '重置';
$handler->display->display_options['exposed_form']['options']['exposed_sorts_label'] = '排序依据';
$handler->display->display_options['exposed_form']['options']['sort_asc_label'] = '升序';
$handler->display->display_options['exposed_form']['options']['sort_desc_label'] = '降序';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'slideshow';
$handler->display->display_options['style_options']['slideshow_type'] = 'views_slideshow_cycle';
$handler->display->display_options['style_options']['slideshow_skin'] = 'default';
$handler->display->display_options['style_options']['skin_info'] = array(
  'class' => 'default',
  'name' => '默认',
  'module' => 'views_slideshow',
  'path' => '',
  'stylesheets' => array(),
);
$handler->display->display_options['style_options']['widgets']['top']['views_slideshow_pager']['weight'] = '1';
$handler->display->display_options['style_options']['widgets']['top']['views_slideshow_pager']['type'] = 'views_slideshow_pager_fields';
$handler->display->display_options['style_options']['widgets']['top']['views_slideshow_pager']['views_slideshow_pager_fields_fields'] = array(
  'field_slideshow' => 0,
  'title' => 0,
  'body' => 0,
  'nid' => 0,
);
$handler->display->display_options['style_options']['widgets']['top']['views_slideshow_controls']['weight'] = '1';
$handler->display->display_options['style_options']['widgets']['top']['views_slideshow_controls']['type'] = 'views_slideshow_controls_text';
$handler->display->display_options['style_options']['widgets']['top']['views_slideshow_slide_counter']['weight'] = '1';
$handler->display->display_options['style_options']['widgets']['bottom']['views_slideshow_pager']['enable'] = 1;
$handler->display->display_options['style_options']['widgets']['bottom']['views_slideshow_pager']['weight'] = '1';
$handler->display->display_options['style_options']['widgets']['bottom']['views_slideshow_pager']['type'] = 'views_slideshow_pager_fields';
$handler->display->display_options['style_options']['widgets']['bottom']['views_slideshow_pager']['views_slideshow_pager_fields_fields'] = array(
  'nid' => 'nid',
  'field_slideshow' => 0,
  'title' => 0,
  'body' => 0,
);
$handler->display->display_options['style_options']['widgets']['bottom']['views_slideshow_controls']['weight'] = '1';
$handler->display->display_options['style_options']['widgets']['bottom']['views_slideshow_controls']['type'] = 'views_slideshow_controls_text';
$handler->display->display_options['style_options']['widgets']['bottom']['views_slideshow_slide_counter']['weight'] = '1';
$handler->display->display_options['style_options']['views_slideshow_cycle']['transition_advanced'] = 1;
$handler->display->display_options['style_options']['views_slideshow_cycle']['timeout'] = '6000';
$handler->display->display_options['style_options']['views_slideshow_cycle']['speed'] = '2000';
$handler->display->display_options['style_options']['views_slideshow_cycle']['delay'] = '0';
$handler->display->display_options['style_options']['views_slideshow_cycle']['start_paused'] = 0;
$handler->display->display_options['style_options']['views_slideshow_cycle']['remember_slide_days'] = '1';
$handler->display->display_options['style_options']['views_slideshow_cycle']['items_per_slide'] = '1';
$handler->display->display_options['style_options']['views_slideshow_cycle']['wait_for_image_load_timeout'] = '3000';
$handler->display->display_options['style_options']['views_slideshow_cycle']['cleartype'] = 0;
$handler->display->display_options['style_options']['views_slideshow_cycle']['cleartypenobg'] = 0;
$handler->display->display_options['row_plugin'] = 'fields';
/* 字段: 内容: 首页幻灯片大图片 */
$handler->display->display_options['fields']['field_slideshow']['id'] = 'field_slideshow';
$handler->display->display_options['fields']['field_slideshow']['table'] = 'field_data_field_slideshow';
$handler->display->display_options['fields']['field_slideshow']['field'] = 'field_slideshow';
$handler->display->display_options['fields']['field_slideshow']['label'] = '';
$handler->display->display_options['fields']['field_slideshow']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_slideshow']['hide_alter_empty'] = FALSE;
$handler->display->display_options['fields']['field_slideshow']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_slideshow']['settings'] = array(
  'image_style' => 'slideshow',
  'image_link' => 'content',
);
$handler->display->display_options['fields']['field_slideshow']['group_column'] = 'fid';
/* 字段: 内容: 标题 */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
/* 字段: 内容: Body */
$handler->display->display_options['fields']['body']['id'] = 'body';
$handler->display->display_options['fields']['body']['table'] = 'field_data_body';
$handler->display->display_options['fields']['body']['field'] = 'body';
$handler->display->display_options['fields']['body']['label'] = '';
$handler->display->display_options['fields']['body']['alter']['max_length'] = '60';
$handler->display->display_options['fields']['body']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['body']['alter']['trim'] = TRUE;
$handler->display->display_options['fields']['body']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['body']['type'] = 'text_plain';
$handler->display->display_options['fields']['body']['settings'] = array(
  'trim_length' => '600',
);
/* 字段: 内容: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['label'] = '';
$handler->display->display_options['fields']['nid']['exclude'] = TRUE;
$handler->display->display_options['fields']['nid']['element_label_colon'] = FALSE;
/* 排序标准: 内容: 发布日期 */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: 内容: 已发表 */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: 内容: 首页幻灯片大图片 (field_slideshow:fid) */
$handler->display->display_options['filters']['field_slideshow_fid']['id'] = 'field_slideshow_fid';
$handler->display->display_options['filters']['field_slideshow_fid']['table'] = 'field_data_field_slideshow';
$handler->display->display_options['filters']['field_slideshow_fid']['field'] = 'field_slideshow_fid';
$handler->display->display_options['filters']['field_slideshow_fid']['operator'] = 'not empty';
$handler->display->display_options['filters']['field_slideshow_fid']['group'] = '0';

/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block');
$translatables['Slideshow'] = array(
  t('Master'),
  t('Slideshow'),
  t('更多'),
  t('应用'),
  t('重置'),
  t('排序依据'),
  t('升序'),
  t('降序'),
  t('Block'),
);
赞成!
0
否决!

就是这个样子,原先第一次创建区块的时候还显示图片,可是自从添加第二篇文章后就什么也不显示了。

赞成!
0
否决!

赞成!
0
否决!

用F12调试一下,看看有什么JS错误信息,这种情况估计是JS问题吧

赞成!
0
否决!

还有在视图里看看预览是不是正常。

赞成!
0
否决!

非常感谢antims的回答!

调试没用过,不知道有没有相关介绍资料呢?

 

在试图里的预览也是一样的效果。

赞成!
0
否决!

在views里先把slideshow效果去掉,预览一下看看有没有几张图出来,如有,说明你的slideshow有问题;如没有,说明你的views配置有问题。就这么简单!!!!

赞成!
0
否决!

再次谢谢antims用心的回答!

我重新安装了一遍,一涉及到代码就没什么心情了^^