Is is possible?

#1
[eluser]Alex-Tunbridge[/eluser]
Okay I was wondering if it was possible to format a Unix Timestamp with Code Igniters Template Parser Class

Here is my code

Controller:
Code:
$query = $this->db->where('page_id',$id)->get(TABLE_PAGES);
                $data['pages'] = $query->row_array();
                $data['title'] = 'Edit Page: '.$data['pages']['title'];
                $this->parser->parse('manage/pages/edit',$data);

View:
Code:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th>Title</th>
    <th>URI Name</th>
    <th>Time Created</th>
  </tr>
  {pages}
  <tr>
    <td>{title}</td>
    <td>{page_uri}</td>
    <td>{time_created}</td>
  </tr>
  {/pages}
</table>

And this is what I'm getting:
http://i26.tinypic.com/bdtu2p.png

#2
[eluser]fireproofsocks[/eluser]
This gets back to the whole idea of view-level filters. I'm wondering the same thing... it doesn't seem that CI's parser class is geared for this. Does anyone know of a valid helper/library that can help format data in the view layer (as an alternative to resorting to raw PHP)?

#3
[eluser]Colin Williams[/eluser]
ontroller:

Code:
$query = $this->db->where('page_id',$id)->get(TABLE_PAGES);
$data['pages'] = $query->row_array();
$data['title'] = 'Edit Page: '.$data['pages']['title'];

// Use a view to format the date, or just format it with the date() func
foreach ($data['pages'] as $i => $page)
{
   $data['pages'][$i]['time_created'] = $this->load->view('dates/medium', array('time' => $page-> time_created), TRUE);
}

$this->parser->parse('manage/pages/edit',$data);


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.