您在這裡

views使用疑问

red's 的頭像
red 在 2011-07-29 (週五) 22:14 發表

刚接触drupal不久,views在生成各种列表非常方便,现在希望能对views生成的fields进行更多处理,无从下手
比如有个field是enable,当enable是1时显示为有效,0时显示为无效。又比如有个field是数值,希望显示时结果除以100显示为百分比
使用d7

多謝guanyuepro
[quote]有个field是数值,希望显示时结果除以100显示为百分比[/quote]
已經搞定,添加Math expression field,被處理field設置隱藏
但改變顯示的字符仍然有困難,誰能提供個sample
[code]
function extdb_views_pre_render(&$view) {
// example code here
switch($view->name) {
case 'test':
foreach($view->result as $result) {
$result->name = '123';
}
$view->result = $result;
break;
}
}
[/code]