簡體   English   中英

drupal 6表theme()輸出

[英]drupal 6 table theme() output

我正在制作一個drupal表,並查找了drupal_theme(),並嘗試遵循以下代碼來構建表的規則:

  $data = array('value', 'values');
  $header = array ($data);
  $rows = array(
    // Simple row
    array(
      'Cell 1', 'Cell 2', 'Cell 3'
    ),
    // Row with attributes on the row and some of its cells.
    array(
      'data' => array('Cell 1', array('data' => 'Cell 2', 'colspan' => 2)),
      'class' => 'funky'
    )
      );

  //$output = theme('table', $header, $rows, $attributes = array(), 
  //$caption = NULL);
  $table_t = theme_table($header, $rows, $attributes = array(), $caption = NULL);
  //return $output;
  return $table_t;

但是,該表不包含我期望的行和列標題。 怎么了??

截圖: 在此處輸入圖片說明

我不確定這是否有幫助,但這是我在一個模塊中使用的表頭的代碼。

  $header = array(
    array('data' => t('One')),
    array('data' => t('Two')),
    array('data' => t('Three')),
    array('data' => t('Four')),
  );

看看是否適合您。

此外, theme_table($header, $rows, $attributes = array(), $caption = NULL)可以只是theme_table($header, $rows)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM