English 中文(简体)
comanigniter - 更改指定行的布局
原标题:Codeigniter - Change layout for specified rows

在 CodeIgniter 中, 我如何更改指定行( 不是全部行)的 HTML 表类的布局? 我尝试过它, 使用模板数组, 但这会影响整个表格的所有行 。

$tmpl = array (
     table_open           =>  <table border="0" cellpadding="4" cellspacing="0"> ,
     heading_row_start    =>  <tr> ,
     heading_row_end      =>  </tr> ,
     heading_cell_start   =>  <th> ,
     heading_cell_end     =>  </th> ,
     row_start            =>  <tr> ,
     row_end              =>  </tr> ,
     cell_start           =>  <td> ,
     cell_end             =>  </td> ,
     row_alt_start        =>  <tr> ,
     row_alt_end          =>  </tr> ,
     cell_alt_start       =>  <td> ,
     cell_alt_end         =>  </td> ,
     table_close          =>  </table> 
);
$this->table->set_template($tmpl); 
最佳回答

抱歉让你失望了, 但无法更改 Codigniter s < a href=" http://codigniter.com/user_ guide/librarians/table.html" rel="nofollow" >HTML Table类列表 的特定行的布局。 虽然模板可以定制, 但不能自定义为特定的行或单元格, 但对于从数组快速调出一个 来说, 它更有用, 并且不是 HTML 表格的完整解决方案 。

在不知道你的具体要求的情况下,可能的解决办法:

  1. 通过事先预设输入数组( 如果您只需要 < code>. highlighted class or something), 将每个单元格包在另一个元素中, 从而生成这样的输出 :

    <tr>
      <td><div class="highlight">Data 1</div></td>
      <td><div class="highlight">Data 2</div></td>
      <!-- etc. -->
    </tr>
    
  2. 不要使用表格类, 但用 HTML、 循环和条件构建旧式的表格类, 这将使您能够完全控制布局 。 < streng> (建议)

问题回答

暂无回答




相关问题
PHP Framework: Ebay Like Site

I am going to be builiding a site like ebay - with all the features of ebay. Please note my payment method is limited to paypal. What would be the best PHP framework to use to build this quickly, ...

What s the proper MVC way to do this....?

Quick question about general MVC design principle in PHP, using CodeIgniter or Kohana (I m actually using Kohana). I m new to MVC and don t want to get this wrong... so I m wondering if i have ...

Check session from a view in CodeIgniter

What is the best way to check session from a view in CodeIgniter, it shows no way in their user guide, otherwise I will have to make two views on everything, which is kinda weird...still a newbie to ...

Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...

CodeIgniter adding semicolons

How do I stop CodeIgniter adding semicolons ; to data sent via POST that contains ampersand &? For example it is converting "a=1&b=2&c=3" into "a=1&b;=2&c;=3". From looking on the forums ...

Best way to make Admin pages in CodeIgniter?

I m working on an app in CodeIgniter, and I want to have admin pages for several of the objects in the application, and I m wondering what would be the better way to put these into an MVC structure. ...

CodeIgniter form verification and class

I m using the form validation library and have something like this in the view <p> <label for="NAME">Name <span class="required">*</span></label> <?...

热门标签