• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Template Parser Help?

#1
[eluser]Captain_Fluffy_Pants[/eluser]
When i put
Code:
<?php
class Blog extends CI_Controller {
  function index()
  {
         $this->load->view('template/header');
         $this->load->view('template/header_bar');
         $this->load->view('pages/home');
         $this->load->view('template/footer');
         $this->load->library('parser');
            $data = array(
            'blog_title' => 'My Blog Title',
            'blog_heading' => 'My Blog Heading'
            );

           $this->parser->parse('blog_template', $data);
  }
}
header.php
Code:
<html>
<head>
<title>{blog_title}</title>
</head>
footer.php
Code:
</body>
</html>
headerbar.php
Code:
left the header-bar blank
home.php
Code:
<body>
<h1>{blog_heading}</h1>
my result was:
http://i.imgur.com/KwtgB.png

please help i dont know what i did wrong D:

#2
[eluser]Aken[/eluser]
It's saying you don't have a view file named blog_template.php

#3
[eluser]Captain_Fluffy_Pants[/eluser]
Big GrinD thank you for pointing that out!! it fixed it c:

#4
[eluser]Captain_Fluffy_Pants[/eluser]
wait could i load the template parser to a folder by any chances?

#5
[eluser]Captain_Fluffy_Pants[/eluser]
changed my controller to:
Code:
&lt;?php
class Blog extends CI_Controller {
  function index()
  {
   $this->load->view('template/header');
   $this->load->view('template/header_bar');
   $this->load->view('pages/home');
   $this->load->view('template/footer');
   $this->load->library('parser');
           $data = array(
            'blog_title' => 'My Blog Title',
            'blog_heading' => 'My Blog Heading'
            );
           $this->parser->parse('template/header', $data);
           $this->parser->parse('template/header_bar', $data);
           $this->parser->parse('template/footer', $data);    

            
  }
}
?&gt;
now this is what is shows http://i.imgur.com/bLSF3.png is that right ?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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