Welcome Guest, Not a member yet? Register   Sign In
Template Parser
#1

[eluser]ann91[/eluser]
hello guys, i have problem about this code. i use codeigniter 2.0.2. In this case, i want to make template with class Template Parser.

Code:
function index()
  {
    $data = array( 'title'   => 'Welcome to my webSite',
                   'content' => 'This is the Content'    
                 );
     $this->parser->parse('main', $data);
  }
and the function Model
Code:
function getRecentPost()
{
  $this->db->select('*');
  $this->db->from('post p');
  $this->db->where('active_post',1);   //
  $this->db->order_by('p.post_id','desc');
  $this->db->limit(5);  //
  return $this->db->get();
}


if i want to add <b>Postmodel</b> into <b>content</b> pseudo-variables, how i write it??

in codeigniter 1.7.2, the code like this..

Code:
function index()
    {
        $data['title']="Welcome to My Website"; //
        $data['content']=$this->postmodel->getRecentPost(); //
        $this->load->view('main',$data);
    }


Messages In This Thread
Template Parser - by El Forum - 05-06-2011, 11:19 AM
Template Parser - by El Forum - 05-06-2011, 01:07 PM
Template Parser - by El Forum - 05-06-2011, 03:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB