您在這裡

如何設置這種效果

sud's 的頭像
sud 在 2008-09-29 (週一) 01:02 發表

如何制作成為https://drupaltaiwan.org/module 這種列表效果
我是新手

這裡的 views 是 1.x 版的,模組列表的 views code 如下(當初是 jimmy 做的):

$view = new stdClass();
$view->name = 'module_list';
$view->description = '模組介紹';
$view->access = array (
0 => '3',
1 => '1',
2 => '2',
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = '模組介紹';
$view->page_header = '以下為 Drupal 部份模組的中文介紹。完整的模組列表,請到 Drupal.org 的模組單元。也歡迎你一起來寫模組介紹!';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = '';
$view->page_empty_format = '1';
$view->page_type = 'list';
$view->url = 'module';
$view->use_pager = TRUE;
$view->nodes_per_page = '50';
$view->sort = array (
array (
'tablename' => 'node',
'field' => 'title',
'sortorder' => 'ASC',
'options' => '',
),
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'node',
'field' => 'title',
'label' => '',
'handler' => 'views_handler_field_nodelink',
'sortable' => '1',
'defaultsort' => 'ASC',
'options' => 'link',
),
array (
'tablename' => 'term_node_7',
'field' => 'name',
'label' => '分類',
'options' => 'nolink',
),
array (
'tablename' => 'node_data_field_module_description',
'field' => 'field_module_description_value',
'label' => '',
'handler' => 'content_views_field_handler_group',
'options' => 'trimmed',
),
array (
'tablename' => 'node_comment_statistics',
'field' => 'comment_count',
'label' => '人回應',
'handler' => 'views_handler_field_int',
'sortable' => '1',
),
array (
'tablename' => 'node_counter',
'field' => 'totalcount',
'label' => '人瀏覽',
'sortable' => '1',
),
array (
'tablename' => 'node_data_field_upload',
'field' => 'field_upload_fid',
'label' => '翻譯',
'handler' => 'content_views_field_handler_group',
'options' => 'default',
),
array (
'tablename' => 'node',
'field' => 'view',
'label' => '',
'options' => '詳細說明',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'content_module',
),
),
array (
'tablename' => 'term_node_7',
'field' => 'tid',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => '327',
1 => '315',
2 => '316',
3 => '312',
4 => '322',
5 => '325',
6 => '326',
7 => '331',
8 => '318',
9 => '320',
10 => '330',
11 => '319',
12 => '329',
13 => '314',
14 => '310',
15 => '311',
16 => '328',
17 => '323',
18 => '321',
19 => '317',
20 => '313',
21 => '324',
),
),
);
$view->exposed_filter = array (
array (
'tablename' => 'term_node_7',
'field' => 'tid',
'label' => '分類',
'optional' => '1',
'is_default' => '0',
'operator' => '1',
'single' => '1',
),
);
$view->requires = array(node, term_node_7, node_data_field_module_description, node_comment_statistics, node_counter, node_data_field_upload);
$views[$view->name] = $view;

英文的module更複雜,改過很多
基本上是views arguments去做的
譬如說,每個Views上面都會有固定的category可以選擇

--
from open mind to open source~

--
from open mind to open source~