Giúp em trình bày nội dung bằng Views ...!!!! Help

Events happening in the community are now at Drupal community events on www.drupal.org.
xuanthong's picture

EM đang muốn trình bày nội dung view theo kiểu giống (file đính kèm ) nhưng e không biết trong view làm sao để trình bày nội dung hàng ngang vậy được , vì em chỉ thấy có 2 phần Header và Footer.

Các anh nào đã từng trình bày kiểu này hay có module nào giúp thực hiện việc đó vui lòng giúp em !!!!

AttachmentSize
nh.JPG91.34 KB

Comments

Dùng thêm attachment trong

khuongkd's picture

Dùng thêm attachment trong views có thể làm được.

Chào bạnCái tin đầu dùng

Nothing4ever's picture

Chào bạn
Cái tin đầu dùng default cho hiển thị 1 tin nhé
Các tin tiếp theo bạn add thêm 1 attachment nữa, sau đó ghi đè(override) những field cần thiết rồi cho hiển thị 4 tin, trừ tin đầu(phần offset chọn 1)

Tiếp theo chọn attach to default và chọn after để chèn cái attact đó vào sau cái default.

Phần còn lại bạn chỉ style cho cái defaut và cái attachment inline thôi, có thể sử dụng float cho chúng.
Lưu ý là cái views attachment đó có class là attachment.

Hy vọng giúp được bạn.

SO sánh nội dung(product) không dùng ub

thanghiep8's picture

Chào các bạn. Trước hết mình xin lội vì đã chen ngan. Nhưng mình tìm không thấy mục tạo thread mới nên post vào đây.
Mình đang xây dựng 1 site TMĐT có chức năng so sánh các field của sản phẩm (sản phẩm là 1 loại content type tự định nghĩa, không dùng ub hay comm do yêu cầu site phải vậy). ACE ai biết module hay giải pháp xin chỉ dùm. Mình có thử qua properties nhưng phải đưa field vào att của module mới có thể so sánh được -> không khả thi vì site mình làm bằng view và panel, không thể join att của module vào view được.

Xin cảm ơn mọi sự giúp đỡ.

Cám ơn bạn đã giúp đỡ. Nhưng

xuanthong's picture

Cám ơn bạn đã giúp đỡ.

Nhưng minh đã thử làm theo cách của bạn chọn style inline cho cả 2 nhưng views attachment nó hiển thị theo cái defaut chỉ hển thị 1 tin

bạn có thể chỉ rõ cho mình về class attachment được không và cách dùng float trong view được không ?
Sr vì mình còn kém về drupal mong các bạn chỉ giảng thêm .

À, do bạn chưa ấn vào chữ

Nothing4ever's picture

À, do bạn chưa ấn vào chữ "Override" nên cái attachment đó vẫn sử dụng của default mà.
style inline ở đây không phải là thiết lập của view đâu nhé, ý mình là float:left cho default và attachment ý
Bạn có thể import cái views này mình làm để tham khảo nhé

$view = new view;
$view->name = 'view_news_news';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'field_image_story_fid' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'image200x154_linked',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_image_story_fid',
    'table' => 'node_data_field_image_story',
    'field' => 'field_image_story_fid',
    'relationship' => 'none',
  ),
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 1,
    'empty_zero' => 0,
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
  'changed' => array(
    'label' => 'Cập nhật',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'date_format' => 'small',
    'custom_date_format' => '',
    'exclude' => 0,
    'id' => 'changed',
    'table' => 'node',
    'field' => 'changed',
    'relationship' => 'none',
  ),
  'field_teaser_value' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 1,
      'max_length' => '300',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_teaser_value',
    'table' => 'node_data_field_teaser',
    'field' => 'field_teaser_value',
    'relationship' => 'none',
  ),
  'title_1' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 1,
      'text' => 'Chi tiết',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title_1',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
  'changed' => array(
    'order' => 'DESC',
    'granularity' => 'second',
    'id' => 'changed',
    'table' => 'node',
    'field' => 'changed',
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'name' => array(
    'operator' => '=',
    'value' => 'Tin tức',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'case' => 1,
    'id' => 'name',
    'table' => 'term_data',
    'field' => 'name',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('header_format', '3');
$handler->override_option('header_empty', 0);
$handler->override_option('footer_format', '1');
$handler->override_option('footer_empty', 0);
$handler->override_option('empty', '<div class="EmptyText">

Không có kết quả nào phù hợp với tiêu chí tìm kiếm của bạn.<br />

</div>');
$handler->override_option('empty_format', '2');
$handler->override_option('items_per_page', 1);
$handler->override_option('use_pager', '0');
$handler->override_option('pager_element', 3);
$handler->override_option('distinct', 1);
$handler->override_option('style_plugin', 'grid');
$handler->override_option('style_options', array(
  'grouping' => '',
  'columns' => '1',
  'alignment' => 'horizontal',
  'fill_single_line' => 1,
));
$handler = $view->new_display('attachment', 'Attachment', 'attachment_1');
$handler->override_option('fields', array(
  'field_image_story_fid' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'anh100_120_linked',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_image_story_fid',
    'table' => 'node_data_field_image_story',
    'field' => 'field_image_story_fid',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Sử dụng mặc định',
    ),
  ),
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 1,
    'empty_zero' => 0,
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
  'changed' => array(
    'label' => 'Cập nhật',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'date_format' => 'small',
    'custom_date_format' => '',
    'exclude' => 0,
    'id' => 'changed',
    'table' => 'node',
    'field' => 'changed',
    'override' => array(
      'button' => 'Sử dụng mặc định',
    ),
    'relationship' => 'none',
  ),
  'field_teaser_value' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 1,
      'max_length' => '100',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_teaser_value',
    'table' => 'node_data_field_teaser',
    'field' => 'field_teaser_value',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Sử dụng mặc định',
    ),
  ),
));
$handler->override_option('items_per_page', 2);
$handler->override_option('offset', 1);
$handler->override_option('use_pager', '1');
$handler->override_option('style_options', array(
  'grouping' => '',
  'columns' => '2',
  'alignment' => 'horizontal',
  'fill_single_line' => 1,
));
$handler->override_option('attachment_position', 'after');
$handler->override_option('inherit_arguments', TRUE);
$handler->override_option('inherit_exposed_filters', FALSE);
$handler->override_option('inherit_pager', FALSE);
$handler->override_option('render_pager', TRUE);
$handler->override_option('displays', array(
  'default' => 'default',
));

Có 2 cách để tạo pages ?

ngudan's picture

Có 2 cách để tạo pages:
- Cách 1: dùng modules panel + kích hoạt page manager trong CCK là tạo được 1 pages, sau đó thích chèn gì vào trang thì tuy(như view, blog..), dùng panel có thể chia các khối, đặt id, class mình thấy nhanh.

Cách 2: dùng modules context:
+tạo view, blog...sau đó ra tạo context add vào các khối.
=> 2 cái này chức năng giống nhau là tạo ra pages để add nội dung, mọi người cho em ý kiến là dùng theo cách nào hay hơn ? tối ưu hơn ?

tương tự như modules "admin_menu" và module "admin" đều có chức năng giống nhau.