philsturgeon / codeigniter-template

Template library for CodeIgniter which supports modules, themes, partial views, etc.
411 stars 178 forks source link

Problem when added single object to be passed to a view #2

Open danielgomezdidier opened 13 years ago

danielgomezdidier commented 13 years ago

When you try to pass a single object to a view you get the following error:

Object of class stdClass could not be converted to string

But as soon you wrap the object in to an array everything work fine.

The problem is present when you use $data[single_obj] = $this->a_model->get_single(); $this->template->build('some_view', $data); or

$this->template->set('single_obj', $this->a_model->get_single() ); $this->template->buil('some_view');

Thank you.

This library is great-

philsturgeon commented 13 years ago

Paste the full error.

PerceptionLLC commented 13 years ago

You probably need to disable the parsing library in the config. Change $config['parser_enabled'] = TRUE; to $config['parser_enabled'] = FALSE;.

curiousteam commented 4 years ago

You probably need to disable the parsing library in the config. Change $config['parser_enabled'] = TRUE; to $config['parser_enabled'] = FALSE;.

Yes, this solves the problem. But how can we use both feature like: Send objects as param and user parser? I faced the same problem