Region 如何使用?
大部分官網提供的 themes 都是比較標準的版型,特別是 block 擺放的位置,很多都是在側邊欄裡頭,有時要突破這個僵局,想把 block 放在版面中的任意位置,於是有 region 的產生。
例如想在 content 的上方和下方各置一個 block, Drupal theme 該如何寫呢?
Step 1: 在 template.php 中定義各個 block 名稱
- 閱讀更多關於Region 如何使用?
- 8 篇回應
- 發表回應前,請先登入或註冊
密技分享、經驗分享、一般使用問題、Drupal好難該該…
大部分官網提供的 themes 都是比較標準的版型,特別是 block 擺放的位置,很多都是在側邊欄裡頭,有時要突破這個僵局,想把 block 放在版面中的任意位置,於是有 region 的產生。
例如想在 content 的上方和下方各置一個 block, Drupal theme 該如何寫呢?
Step 1: 在 template.php 中定義各個 block 名稱
Google Custom Search可以讓你把搜尋引擎整合進網站裡~
但是Drupal對於google送出搜尋字串的q變數,把他當路徑
所以若要將結果頁面整合進Drupal裡頭,就會出現一直找不到頁面
在一陣搜尋之後找到了解答
http://www.techmag.biz/integrating_google_custom_search_engines_drupal
這篇文章整理的很好,轉貼一下
Drupal Cache Performance Module List
http://drupal.org/node/97347
cache的方式,模組:
- Boost Module
- Splitting up Cache Table
- File Based Cache
- Fast Path Caching
- Improving Category Caching
- Memcache
- Block Cache (for blocks, so kind of independent, but list for reference)
連結與介紹:
Boost Module (not released yet)
想整合一个地图程序,要求一个用户代码,不知该如何做?
这是那段代码:
<?php
/*
* init
*
* (c) 2007 mapinbox.com
*/
define('M_CHARSET', 'utf-8');
$domain = 'XXXXX.cn'; // 您的域
$authkey = '311111111111110'; // 密钥
// 如果需要跟现有的用户系统整合,请在下方插入获取当前用户的代码
首先我安裝的程序如下
1.download Drupal5.1的tar版
2.用 ftp傳過去unix的機器上(OS版本為solaris 5.2)
3.用tar -zxvf 解壓縮檔案
4.設定好settings.php之檔案ftp過去 site/default/settings.php覆蓋並將檔案設定為777
5.開一個新的database
6.打開IE使用install.php來設定好相關資訊
如題
我在官網找到bbclone的安裝方法
http://drupal.org/node/43840
不過沒有效果
請問有人有裝過嗎??
稍微修改一下顯示中文的系統運行時間(uptime)跟負載的小片段程式
1. 新增區塊
2. 輸入以下程式碼
<?php
$uptime = shell_exec("cut -d. -f1 /proc/uptime");
$loadavg_array = explode(" ", exec("cat /proc/loadavg"));
printf("現在時刻: %s 運行: %.0f天 %02.0f分 %02.0f秒負載: %s, %s, %s\n",
strftime("%l:%M%p"), floor($uptime/86400), $uptime/3600%24, $uptime/60%60,
$loadavg_array[0], $loadavg_array[1], $loadavg_array[2]);
?>
3. 儲存後選擇區塊顯示的位置, 可以設定只在顯示首頁 ()
各位好:
TKY之前有在討論版上問過一個問題,就是本站node頁尾都有的「上一主題\下一主題與up」的連結要怎麼做?不過好像因為插在其他的問題討論裡頭,所以沒人特別注意。
TKY這次特地另開個主題問問版上的老手們:要做哪方面的設定才能做到每個node底下都可以有上一主題\下一主題與up」的連結呢?
謝謝大家
TKY
首先,
確定自己有安裝好cvs,然後用以下指令把develop的doc檔案給checkout出來cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-4-7 -d developer contributions/docs/developer
然後,把她拷貝到想要的建立程式api索引的資料夾裡頭
註: 如果想要的不是4.7而是head版本,用把DRUPAL-4-7 改成 HEAD
再來,
安裝API這個module,拷貝到modules/資料夾裡頭,然後在admin/modules裡頭啟用
接下來,
如何做一個版型...
有tutorial 或 manual 嗎?
大家好。
我用的是4.7,想把acidfree的區塊放在content region,
但acidfree的區塊都是垂直顯示的,感覺怪怪,
請問怎樣可以改成水平,由左至右顯示呢?
謝謝。
在模块开发时如何在生成的select类型的html元件上加入javascript代码
如我在开发时想加入一个选项用于存放地址数据.
address1
address2
还有一个用于地址输入的文本框
我是想在select上加一段javascript代码 如变成这样:
address1
address2
看到一個很酷的熱門內容呈現方式:
Display the most popular content in a way like c|Net's what's hot
範例:
<?php
/**
* This php snippet displays a list of links
* to most viewed pages
*
* To increase/decrease the number of nodes listed
* change the $list_length value to suit.
*
* Works with drupal 4.7.x & 4.6.x & 4.5.x
*
* Snippet submitted by aam
*/
$output = "\n";
$output .= "
/* ************** Hottest of all time *************************/
$list_length = 15;
$sql = "SELECT b.title, a.nid, b.created AS min_time, CASE WHEN a.totalcount > 0 THEN a.totalcount ELSE 1 END AS rec_cnt FROM node_counter a LEFT JOIN node b ON a.nid = b.nid ORDER BY rec_cnt DESC LIMIT $list_length";
$all_nodes = array();
$result = db_query($sql);
$i=0;
$max_time_all = 19000101;
$min_time_all = 99991231;
$max_rec_cnt_all = 0;
$min_rec_cnt_all = 999999999;
$rec_cnt_all = 0;
while ($mynode = db_fetch_object($result)) {
$i += 1;
$all_nodes[$i] = array(
'title' => $mynode->title,
'path' => ('/node/'.$mynode->nid),
'min_time' => format_date($mynode->min_time,'custom', 'Ymd')+0,
'rec_cnt' => $mynode->rec_cnt
);
$rec_cnt_all += $mynode->rec_cnt;
if ( $all_nodes[$i]['min_time'] > $max_time_all ) $max_time_all = $all_nodes[$i]['min_time'];
if ( $all_nodes[$i]['min_time'] < $min_time_all ) $min_time_all = $all_nodes[$i]['min_time'];
if ( $all_nodes[$i]['rec_cnt'] > $max_rec_cnt_all ) $max_rec_cnt_all = $all_nodes[$i]['rec_cnt'];
if ( $all_nodes[$i]['rec_cnt'] < $min_rec_cnt_all ) $min_rec_cnt_all = $all_nodes[$i]['rec_cnt'];
}
$a_x = 0; $a_y = 0;
$d_x = 500; $d_y = 500;
$ratio = 0.4;
//$output .= " rec_cnt_all = $rec_cnt_all \n";
//$output .= " max_time_all = $max_time_all \n";
//$output .= " min_time_all = $min_time_all \n";
//$output .= " max_rec_cnt_all = $max_rec_cnt_all \n";
//$output .= " min_rec_cnt_all = $min_rec_cnt_all \n";
$output .= "
\n";
$pos += round(($node['rec_cnt']/$sum_rec_cnt)*($d_y-$a_y));
}
// set the target area
$a_x += $width;
}
else {
// drawing area
$width = round( ($sum_rec_cnt/$rec_cnt_all) * ($d_y-$a_y) );
$pos=$a_x;
foreach($myitems as $node) {
$output .= "
\n";
$pos += round(($node['rec_cnt']/$sum_rec_cnt)*($d_x-$a_x));
}
// set the target area
$a_y += $width;
}
// reset algorithm
$i = 1;
$rec_cnt_all -= $sum_rec_cnt;
$sum_rec_cnt = 0;
unset($myitems);
$myitems = array();
}
}
$output .= "
\n";
/* ************** Hottest of today *************************/
$list_length = 15;
$sql = "SELECT b.title, a.nid, b.created AS min_time, CASE WHEN a.daycount > 0 THEN a.daycount ELSE 1 END AS rec_cnt FROM node_counter a LEFT JOIN node b ON a.nid = b.nid ORDER BY rec_cnt DESC LIMIT $list_length";
$all_nodes = array();
$result = db_query($sql);
$i=0;
$max_time_all = 19000101;
$min_time_all = 99991231;
$max_rec_cnt_all = 0;
$min_rec_cnt_all = 999999999;
$rec_cnt_all = 0;
while ($mynode = db_fetch_object($result)) {
$i += 1;
$all_nodes[$i] = array(
'title' => $mynode->title,
'path' => ('/node/'.$mynode->nid),
'min_time' => format_date($mynode->min_time,'custom', 'Ymd')+0,
'rec_cnt' => $mynode->rec_cnt
);
$rec_cnt_all += $mynode->rec_cnt;
if ( $all_nodes[$i]['min_time'] > $max_time_all ) $max_time_all = $all_nodes[$i]['min_time'];
if ( $all_nodes[$i]['min_time'] < $min_time_all ) $min_time_all = $all_nodes[$i]['min_time'];
if ( $all_nodes[$i]['rec_cnt'] > $max_rec_cnt_all ) $max_rec_cnt_all = $all_nodes[$i]['rec_cnt'];
if ( $all_nodes[$i]['rec_cnt'] < $min_rec_cnt_all ) $min_rec_cnt_all = $all_nodes[$i]['rec_cnt'];
}
$a_x = 0; $a_y = 0;
$d_x = 500; $d_y = 500;
$ratio = 0.4;
//$output .= " rec_cnt_all = $rec_cnt_all \n";
//$output .= " max_time_all = $max_time_all \n";
//$output .= " min_time_all = $min_time_all \n";
//$output .= " max_rec_cnt_all = $max_rec_cnt_all \n";
//$output .= " min_rec_cnt_all = $min_rec_cnt_all \n";
$output .= "
\n";
$pos += round(($node['rec_cnt']/$sum_rec_cnt)*($d_y-$a_y));
}
// set the target area
$a_x += $width;
}
else {
// drawing area
$width = round( ($sum_rec_cnt/$rec_cnt_all) * ($d_y-$a_y) );
$pos=$a_x;
foreach($myitems as $node) {
$output .= "
\n";
$pos += round(($node['rec_cnt']/$sum_rec_cnt)*($d_x-$a_x));
}
// set the target area
$a_y += $width;
}
// reset algorithm
$i = 1;
$rec_cnt_all -= $sum_rec_cnt;
$sum_rec_cnt = 0;
unset($myitems);
$myitems = array();
}
}
$output .= "
\n";
/* ************** Hottest of last week *************************/
$list_length = 15;
$sql = "SELECT title, path, MAX(timestamp) AS min_time, COUNT(*) AS rec_cnt FROM accesslog WHERE path LIKE '%book/%' OR path LIKE '%node/%' OR path LIKE '%image/%' GROUP BY title, path ORDER BY rec_cnt DESC LIMIT $list_length";
$all_nodes = array();
$result = db_query($sql);
$i=0;
$max_time_all = 19000101;
$min_time_all = 99991231;
$max_rec_cnt_all = 0;
$min_rec_cnt_all = 999999999;
$rec_cnt_all = 0;
while ($mynode = db_fetch_object($result)) {
$i += 1;
$all_nodes[$i] = array(
'title' => $mynode->title,
'path' => $mynode->path,
'min_time' => format_date($mynode->min_time,'custom', 'Ymd')+0,
'rec_cnt' => $mynode->rec_cnt
);
$rec_cnt_all += $mynode->rec_cnt;
if ( $all_nodes[$i]['min_time'] > $max_time_all ) $max_time_all = $all_nodes[$i]['min_time'];
if ( $all_nodes[$i]['min_time'] < $min_time_all ) $min_time_all = $all_nodes[$i]['min_time'];
if ( $all_nodes[$i]['rec_cnt'] > $max_rec_cnt_all ) $max_rec_cnt_all = $all_nodes[$i]['rec_cnt'];
if ( $all_nodes[$i]['rec_cnt'] < $min_rec_cnt_all ) $min_rec_cnt_all = $all_nodes[$i]['rec_cnt'];
}
$a_x = 0; $a_y = 0;
$d_x = 500; $d_y = 500;
$ratio = 0.4;
//$output .= " rec_cnt_all = $rec_cnt_all \n";
//$output .= " max_time_all = $max_time_all \n";
//$output .= " min_time_all = $min_time_all \n";
//$output .= " max_rec_cnt_all = $max_rec_cnt_all \n";
//$output .= " min_rec_cnt_all = $min_rec_cnt_all \n";
$output .= "
\n";
$pos += round(($node['rec_cnt']/$sum_rec_cnt)*($d_y-$a_y));
}
// set the target area
$a_x += $width;
}
else {
// drawing area
$width = round( ($sum_rec_cnt/$rec_cnt_all) * ($d_y-$a_y) );
$pos=$a_x;
foreach($myitems as $node) {
$output .= "
\n";
$pos += round(($node['rec_cnt']/$sum_rec_cnt)*($d_x-$a_x));
}
// set the target area
$a_y += $width;
}
// reset algorithm
$i = 1;
$rec_cnt_all -= $sum_rec_cnt;
$sum_rec_cnt = 0;
unset($myitems);
$myitems = array();
}
}
$output .= "
\n";
/* ******* end of container ************ */
$output .= "
\n";
$output .= "\n";
$output .= "熱門內容 全部\n";
$output .= " 今天\n";
$output .= " 上週\n";
$output .= "區塊愈大,代表愈熱門。\n";
$output .= "區塊顏色愈深,表示是比較舊的內容\n";
$output .= "\n";
print $output;
?>
原本的 node.tpl.php 會把所有次分類都列出來,但是我想要以主分類為依據,把次分類分別顯示出來,例如:
# 主題分類:hacking | drupal
# 地區分類:台北 | 台灣
在 Drupal.org 裡找到這個可用:
sort taxonony links ($terms) by vocabulary ($vid)