Adding fields to list_items data for 'pages'
Hello,
for learning purposes, i would like to hook into the returned data of 'pages' list view, and add some more fields of my own preference. I have a couple of problems:
1) I've added the list_items function to the
pages_model.php file inside the fuel module, but no matter what i add to the select array, it won't be rendered in the resulting table :
function list_items($limit = NULL, $offset = NULL, $col = 'location', $order = 'asc')
{
$this->db->select('id, location, layout, published, test as Sometext', FALSE);
$data = parent::list_items($limit, $offset, $col, $order);
return $data;
}
where 'test' is an actual table field in the DB.
I don't get it, the same method works for my own modules...
2) What if I wanted to 'merge' some table rows with the page_model table data? ie. say i wanted to display the picture of the author in the list view of the 'pages' model? Do I have to ditch the parent::list_items call and just do my own from scratch, making sure the data gets returned in an array?
Hope it's clear... thanks!
Comments
2. You can do some further processing of the field data to get the field values you want, including html for images you want to display in the table right after your $data = parent::list_items($limit, $offset, $col, $order); call. The data table just takes an array of associative arrays to render.
Hope that helps.
can i assign those table_headers directly from the pages_model?