想詢問若想於做出如下圖中的增加檔案路徑網址。 是不是修改它的theme就好呢? 也就是從這方向著手是嘛? function theme_upload_attachments($files) { xxx} 附加檔案大小 url.PNG3.59 KB 模組/Modules6.x 發表回應前,請先登入或註冊 Re: 想詢問增加檔案路徑網址問題 大概找到一些思路了 由於是修改webfm的部份,它的增加顯示欄位和drupal的upload不同。 所以就從第一步從webfm.admin_.txt下手,去增加一個path欄位。 $form['attach']['attrib']['webfm_attach_path'] = array('#type' => 'checkbox', '#title' => t('Enable file path column'), '#default_value' => variable_get('webfm_attach_path', ''), '#description' => t('Check this box to add a filepath column to the attachment table.') ); 第二步從webfm_theme.txt著手去顯示啟用path欄位 function theme_webfm_attachments($files) { global $base_url; $header = array(t('Attachment')); if($enable_date = variable_get('webfm_attach_date', '')) { array_push($header, t('Date')); } if($enable_size = variable_get('webfm_attach_size', '')) { array_push($header, t('Size')); } //add enable path if($enable_path = variable_get('webfm_attach_path', '')) { array_push($header, t('path')); } 那剩下的思路就是怎麼於webfm.theme中去增加顯示檔案的路徑了。 (如附圖show_url.PNG的效果) 發表回應前,請先登入或註冊 Re: 想詢問增加檔案路徑網址問題 <?php if($enable_date) { $time = $file->fcreatedate ? date(webfm_get_date_format(), $file->fcreatedate) : date(webfm_get_date_format(), @filemtime($file->p . '/'. $file->n)); array_push($row, array('data' => $time, 'class' => 'att-time')); } if($enable_size) { array_push($row, array('data' => format_size($file->s), 'class' => 'att-size')); } // 在這裏增加路徑,參考上面的 $enable_size ?> 它是使用了 theme_tablehttp://api.drupal.org/api/function/theme_table/6 ---notaBlueScreen | 訂閱RSS | Plurk 發表回應前,請先登入或註冊
Re: 想詢問增加檔案路徑網址問題 大概找到一些思路了 由於是修改webfm的部份,它的增加顯示欄位和drupal的upload不同。 所以就從第一步從webfm.admin_.txt下手,去增加一個path欄位。 $form['attach']['attrib']['webfm_attach_path'] = array('#type' => 'checkbox', '#title' => t('Enable file path column'), '#default_value' => variable_get('webfm_attach_path', ''), '#description' => t('Check this box to add a filepath column to the attachment table.') ); 第二步從webfm_theme.txt著手去顯示啟用path欄位 function theme_webfm_attachments($files) { global $base_url; $header = array(t('Attachment')); if($enable_date = variable_get('webfm_attach_date', '')) { array_push($header, t('Date')); } if($enable_size = variable_get('webfm_attach_size', '')) { array_push($header, t('Size')); } //add enable path if($enable_path = variable_get('webfm_attach_path', '')) { array_push($header, t('path')); } 那剩下的思路就是怎麼於webfm.theme中去增加顯示檔案的路徑了。 (如附圖show_url.PNG的效果) 發表回應前,請先登入或註冊
Re: 想詢問增加檔案路徑網址問題 <?php if($enable_date) { $time = $file->fcreatedate ? date(webfm_get_date_format(), $file->fcreatedate) : date(webfm_get_date_format(), @filemtime($file->p . '/'. $file->n)); array_push($row, array('data' => $time, 'class' => 'att-time')); } if($enable_size) { array_push($row, array('data' => format_size($file->s), 'class' => 'att-size')); } // 在這裏增加路徑,參考上面的 $enable_size ?> 它是使用了 theme_tablehttp://api.drupal.org/api/function/theme_table/6 ---notaBlueScreen | 訂閱RSS | Plurk 發表回應前,請先登入或註冊
Re: 想詢問增加檔案路徑網址問題
大概找到一些思路了
由於是修改webfm的部份,它的增加顯示欄位和drupal的upload不同。
所以就從第一步從webfm.admin_.txt下手,去增加一個path欄位。
$form['attach']['attrib']['webfm_attach_path'] =
array('#type' => 'checkbox',
'#title' => t('Enable file path column'),
'#default_value' => variable_get('webfm_attach_path', ''),
'#description' => t('Check this box to add a filepath column to the attachment table.')
);
第二步從webfm_theme.txt著手去顯示啟用path欄位
function theme_webfm_attachments($files) {
global $base_url;
$header = array(t('Attachment'));
if($enable_date = variable_get('webfm_attach_date', '')) {
array_push($header, t('Date'));
}
if($enable_size = variable_get('webfm_attach_size', '')) {
array_push($header, t('Size'));
}
//add enable path
if($enable_path = variable_get('webfm_attach_path', '')) {
array_push($header, t('path'));
}
那剩下的思路就是怎麼於webfm.theme中去增加顯示檔案的路徑了。
(如附圖show_url.PNG的效果)
Re: 想詢問增加檔案路徑網址問題
<?php
if($enable_date) {
$time = $file->fcreatedate ? date(webfm_get_date_format(), $file->fcreatedate) : date(webfm_get_date_format(), @filemtime($file->p . '/'. $file->n));
array_push($row, array('data' => $time, 'class' => 'att-time'));
}
if($enable_size) {
array_push($row, array('data' => format_size($file->s), 'class' => 'att-size'));
}
// 在這裏增加路徑,參考上面的 $enable_size
?>
它是使用了 theme_table
http://api.drupal.org/api/function/theme_table/6
---
notaBlueScreen | 訂閱RSS | Plurk