Drupal 是一套開放源碼的內容管理平台,擁有多種實用的功能,可以用來建置從個人網誌到大型網路社群等各種類型的網站,例如華納唱片、紐約觀察報、Fast Company、Popular Science、SonyBMG、富比士、哈佛大學等網站,或是個人部落格(Tim Berners-Lee)、播客網站(TWIT.tv)、線上社群(SpreadFireFox.com)。
Drupal 是一套開放源碼的內容管理平台,擁有多種實用的功能,可以用來建置從個人網誌到大型網路社群等各種類型的網站,例如華納唱片、紐約觀察報、Fast Company、Popular Science、SonyBMG、富比士、哈佛大學等網站,或是個人部落格(Tim Berners-Lee)、播客網站(TWIT.tv)、線上社群(SpreadFireFox.com)。
Re: 是否可以在view中建立一個到另一個view的鏈接
找到了一個Views Static Field模組,是用于在view中添加一個新的字段(field)的
但是很可惜這只能添加一個靜態文本。
Re: 是否可以在view中建立一個到另一個view的鏈接
有個 view insert 的模組,試試看?
http://drupal.org/project/insert_view
Re: 是否可以在view中建立一個到另一個view的鏈接
這個 insert_view 我已經試過了,它是將 view 嵌入 node或block中的。
和我的將 view 的鏈接作為 field 放入另一個 view 中還是不一樣。
Re: 是否可以在view中建立一個到另一個view的鏈接
也許不用 views
自己寫一個模組來輸出 table 可能比較快
Re:
是的, 通過自己寫模組來呈現對數據庫表的query結果是一個好辦法。
下面是我的步驟和一個不清楚的地方
1)建立菜單項和相關路徑
function waiting_queue_menu($may_cache) {
global $user;
$items = array();
if ($may_cache) {
$items[] = array('path' => 'view/all/content_waitingqueue' ,
'title' => t('等待指導'),
'type' => MENU_NORMAL_ITEM,
'weight'=> 3,
'access' => user_access('view waiting queue'));
}
return $items;
}
2)對數據庫的操作和table的呈現是通過覆蓋現有的主題函數來達到
vim themes/garland/template.php添加
function phptemplate_xxx_xxx($arg1, ...) {
return _phptemplate_callback('xxx_xxx', ...));
}
vim xxx_xxx..tpl.php
相關
$data_fields = db_query(....);
while( $data_field = db_fetch_object($data_fields)){
.....
填充數據
}
我這裏不清楚的是
上面自己建立的菜單項和相關的路徑,在主題中是要與那個
主題函數相關呢?也就是這裏 phptemplate_xxx_xxx 要覆蓋那個現有的主題函數呢?
Re: 是否可以在view中建立一個到另一個view的鏈接
利用 theme_table 來輸出 drupal 樣式的表格
<?php
function waiting_queue_menu($may_cache) {
global $user;
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'view/all/content_waitingqueue' ,
'title' => t('等待指導'),
'type' => MENU_NORMAL_ITEM,
'weight'=> 3,
'access' => user_access('view waiting queue'),
'callback' => 'waiting_queue_list'
);
}
return $items;
}
function waiting_queue_list(){
$header = array(
'field1',
'field2',
'field3'
);
$data_fields = db_query(....);
while( $data_field = db_fetch_object($data_fields)){
$rows[] = array(
$data_field->field1,
$data_field->field2,
$data_field->field3,
);
}
$output = theme('table', $header, $rows);
return $output;
}
?>
theme_table 的詳細說明可以看
http://api.drupal.org/api/function/theme_table/5
可以用來輸出跟 使用者列表 一樣格式的 table
另外還有分頁以及欄位排序等進階用法
分頁需要搭配 pager_query($query, $limit = 10, $element = 0, $count_query = NULL)
欄位排序需要搭配 tablesort_sql($header, $before = '')
Re: 是否可以在view中建立一個到另一個view的鏈接
有了你的這個指導,我應該可以把它完成, 感激,謝謝!
Re: 是否可以在view中建立一個到另一個view的鏈接
謝謝hom, 這個問題已經成功的解決了.
感覺很好, 特別是對通過數據庫的查詢和自己建立table顯示, 在要更改鏈接地址時真的是自己直接做比用views模組更靈活, 讓我印象深刻.