Limon
Limon

Reputation: 1793

smarty not working in codeigniter

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?

Upvotes: 0

Views: 590

Answers (1)

Arkar Aung
Arkar Aung

Reputation: 3584

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.

Upvotes: 1

Related Questions