0

I am dealing with table's using codeigniter's inbuilt function, currently I have an object with data that would be of 3 columns, which can directly be passed to

echo $this->table->generate($obj);

to generate the table. However I would like to extend this structure and have 4 columns. The output is:

Id   Title          Description 

2   fdgdgdf         sdfsfsfs
3   fsdfsdf         sdfsfsdfsf

I would like it to be

Id   Title          Description    Action

2   fdgdgdf         sdfsfsfs         edit
3   fsdfsdf         sdfsfsdfsf       edit

Moreover, is there a way via which I can use the id... for the action edit (which is a hyperlink). Or is it the best to go for the conventional way i.e. plain PHP for loops?

4

1 回答 1

0

第一件事 - 在标题中添加一个字段:

$this->table->set_heading('Id', 'Title', 'Description', 'Action');

接下来 - 只需形成 $obj[3] 或最后一列,如下所示:

$obj[3] = '<a href=".../'.$obj[0].'"></a>';
于 2013-08-21T16:59:14.150 回答