0

I installed Smarty in Codeigniter and it's not really working. Here is what I did:

  1. I followed this instructions:

    http://sunwebexpert.com/books/detail/PHP/integrating-smarty-and-codeigniter.html

But I also put another file in the library: parser.php which is a library to do parsing (I've used it before with smarty and worked well)

  1. the on Codeigniter's autoload.php wrote this:

    $autoload['libraries'] = array('parser','smarty');
    
  2. On main controller I wrote this function to test:

    public function index()
    {
      $this->data['d'] = 2;
      $this->parser->parse('base/test.tpl', $this->data);
    }
    

but the result is no error display and I see the variable 'd' as it is wrote in the template:

{$d}

So I have two questions:

  1. Why can't I see the variable value if I installed smarty as I did before in other projects?

  2. How can I enable to see errors if there are?

Limon
  • 1,772
  • 7
  • 32
  • 61
  • answer of 2: in your root folder of CoideIgniter, open the `index.php` file and around line 21, set `define('ENVIRONMENT', 'development');`. This will enable you to show any error, warning, notice messages. – Ariful Haque Apr 09 '15 at 19:17

1 Answers1

1

The problem is that in codeigniter, there is a built-in library called Parser. That's why this may cause conflict with your library name. Try to rename your library name or use built-in library.

Here is how to display error on codeigniter.

Hope it will be useful for you.

Community
  • 1
  • 1
Arkar Aung
  • 3,554
  • 1
  • 16
  • 25
  • thank you. Yesterday I could figure it out with a friend's help and this was the problem. I was using another Parser class, not codeigniter's one. – Limon Apr 10 '15 at 11:56