2010-07-03 51 views

回答

-2

如果我是你,我會遠離CI表類;它過於混亂,並且不會讓事情變得更容易或者節省您的工作。

我更喜歡這樣的:

<table cellspacing="0" cellpadding="4"> 
<tr> 
<th>Col One</th> 
<th>Col Two</th> 
<th>Col Three</th> 
</tr> 

<?php if($table_data != FALSE){?> 
<?php foreach($table_data->result() as $row){?> 

<tr <?php echo (expr to find the row)? 'class="your_class"' : ''; ?>> 

<td></td> 
<td></td> 

<td><a href="#"></a></td> 

</tr> 
<?php }?> 
<?php }?> 
</table> 
+0

這與問的問題無關... – Mbrevda 2012-03-25 12:15:34

+0

難道不是嗎,請你解釋一下嗎? – DRL 2012-03-26 10:15:50

+0

要問的是如何做一些事情,而不是你對它的實施意見 – Mbrevda 2012-03-26 15:59:39

1

你不能在一個類中,你可以添加額外的屬性與其他元素CI-風格相同的方式添加到行。你可以,但是,添加一個類每一個TD成一排,然後在類的操作,因爲它引用整個行:

$td1 = array(
    'data' => '/*actual html you want in the td*/', 
    'class' => 'myclass' 
); 
$table->add_row($td1); 

這很煩人不得不做每一個TD這樣的,和它不是真的不想做你想做的事情,但這是我見過的所有解決方案中最好的。