您在這裡

附加檔案跳出視窗

sinless's 的頭像
sinless 在 2009-02-10 (二) 09:22 發表

哈囉...大家好..
我想要請問大家一下..我碰到一個問題
就是我想要讓附加檔案是用跳出視窗的方式...請問我應該修改哪個部份的程式碼呢??

我想到幾個方式
1. 最快但是最不drupal的方式, 直接在 node-your_content_type.tpl.php 裡 override 附加檔案欄位
2. 安裝popup filter module, 然後在node-your_content_type.tpl.php 裡加入tag
3. 在template.php 寫一個function, 在這個function裡 呼叫js 檔案 (或invoke module) , override 附加檔案的欄位.

以下是關於drupal popup的幾個連結:
http://groups.drupal.org/node/8452
http://drupal.org/project/popup_filter
http://drupal.org/project/popups

Best Regards, Jessie

試試看是不是你所要的效果


<?php
function phptemplate_upload_attachments($files) {
$header = array(t('Attachment'), t('Size'));
$rows = array();
foreach ($files as $file) {
$file = (object)$file;
if ($file->list && empty($file->remove)) {
$href = file_create_url($file->filepath);
$text = $file->description ? $file->description : $file->filename;
//$rows[] = array(l($text, $href), format_size($file->filesize));
$popup = '';
$rows[] = array($popup, format_size($file->filesize));
}
}
if (count($rows)) {
return theme('table', $header, $rows, array('id' => 'attachments'));
}
}
?>